From: Philip Withnall <[email protected]>
Date: Fri, 15 Feb 2013 12:56:16 +0000

It expects ((msg_controllen == 0) == (msg_control == NULL)), and returns
EINVAL otherwise. It can't hurt to be tidy about things on other platforms
either though.

See: http://www.freebsd.org/cgi/query-pr.cgi?pr=docs/99356#reply2

Signed-off-by: Philip Withnall <[email protected]>
Signed-off-by: Karsten Otto <[email protected]>
---
src/connection.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/connection.c b/src/connection.c
index f292853..c4eb354 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -287,10 +287,19 @@ 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;

+               /* FreeBSD requires msg_control to be set to NULL iff
+                * msg_controllen is 0 (see
+                * http://www.freebsd.org/cgi/query-pr.cgi?pr=docs/99356#reply2)
+                * Can't hurt to do that on all platforms. */
+               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

Reply via email to