[PATCH xcb] Check for POLLERR, POLLHUP, and POLLNVAL in _xcb_conn_wait.

Aaron Plattner aplattner at nvidia.com
Sat Jul 10 23:24:02 PDT 2010


Fixes the XTS XConnectionNumber test.

This test creates a display connection, closes its file descriptor, tries to
send a no-op, and then expects an error.  XCB just goes into an infinite loop
because poll() returns immediately with POLLNVAL set.

Signed-off-by: Aaron Plattner <aplattner at nvidia.com>
---
 src/xcb_conn.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/xcb_conn.c b/src/xcb_conn.c
index 50a662b..6a07730 100644
--- a/src/xcb_conn.c
+++ b/src/xcb_conn.c
@@ -337,6 +337,16 @@ int _xcb_conn_wait(xcb_connection_t *c, pthread_cond_t *cond, struct iovec **vec
         if(FD_ISSET(c->fd, &wfds))
 #endif
             ret = ret && write_vec(c, vector, count);
+
+#if USE_POLL
+        if((fd.revents & (POLLERR |
+                          POLLHUP |
+                          POLLNVAL)))
+        {
+            _xcb_conn_shutdown(c);
+            ret = 0;
+        }
+#endif
     }
 
     if(count)
-- 
1.7.0.4

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg/attachments/20100710/88495197/attachment.pgp>


More information about the xorg mailing list