connection: properly use sendmsg(2) and recvmsg(2)

- Properly align cmsg as per man:cmsg(3).
- Use ssize_t to hold the return value of sendmsg(2) and recvmsg(2).
- Avoid casting the return value of CMSG_DATA as per man:cmsg(3).

Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
This commit is contained in:
Demi Marie Obenour 2024-07-27 18:15:33 -04:00
parent 9cb3d7aa9d
commit b9d8c43d30
2 changed files with 34 additions and 16 deletions

View file

@ -32,6 +32,7 @@
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <sys/types.h>
#define WL_HIDE_DEPRECATED 1
@ -133,13 +134,13 @@ wl_connection_copy(struct wl_connection *connection, void *data, size_t size);
void
wl_connection_consume(struct wl_connection *connection, size_t size);
int
ssize_t
wl_connection_flush(struct wl_connection *connection);
uint32_t
wl_connection_pending_input(struct wl_connection *connection);
int
ssize_t
wl_connection_read(struct wl_connection *connection);
int