From: Philip Withnall <[email protected]>
BSD systems expect all unused fields in the msghdr struct to be
initialized to 0 and NULL respectively, and returns EINVAL otherwise.
It can't hurt to be tidy about things on other platforms either though.
[KAO: Make comments refer to all BSD-like systems]
---
src/connection.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/connection.c b/src/connection.c
index f292853..e728fd8 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -287,10 +287,16 @@ wl_connection_flush(struct wl_connection *connection)
msg.msg_namelen = 0;
msg.msg_iov = iov;
msg.msg_iovlen = count;
- msg.msg_control = cmsg;
- msg.msg_controllen = clen;
+ msg.msg_control = NULL;
+ msg.msg_controllen = 0;
msg.msg_flags = 0;
+ /* Only set msg_control when sending ancillary data */
+ if (clen > 0) {
+ msg.msg_controllen = clen;
+ msg.msg_control = cmsg;
+ }
+
do {
len = sendmsg(connection->fd, &msg,
MSG_NOSIGNAL | MSG_DONTWAIT);
--
1.9.1
_______________________________________________
wayland-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/wayland-devel