Otherwise a client may receive data with an unrelated file
descriptor after calling recvmsg() if its input buffer is not
big enough. In libxcb it may lead to a situation when all
received messages fit the buffer while a message related to
the attached fd is not received yet. libxcb can't find the
corresponding message and fails with XCB_CONN_CLOSED_FDPASSING_FAILED
error.
---
 os/io.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/os/io.c b/os/io.c
index b099f0967..f4e80557d 100644
--- a/os/io.c
+++ b/os/io.c
@@ -488,6 +488,9 @@ WriteFdToClient(ClientPtr client, int fd, Bool do_close)
 #if XTRANS_SEND_FDS
     OsCommPtr oc = (OsCommPtr) client->osPrivate;
 
+    if (oc->output && oc->output->count > 0)
+        (void) FlushClient(client, oc, (char *) NULL, 0);
+
     return _XSERVTransSendFd(oc->trans_conn, fd, do_close);
 #else
     return -1;
-- 
2.11.0

_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to