[PATCH xserver 3/5] os: Don't call ospoll_listen/ospoll_mute after connection is closed

Keith Packard keithp at keithp.com
Wed May 17 16:57:27 UTC 2017


In set_poll_client, check oc->trans_conn to make sure the connection
is still running before changing the ospoll configuration of the file
descriptor in case some other bit of the server is now using this file
descriptor.

Signed-off-by: Keith Packard <keithp at keithp.com>
---
 os/connection.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/os/connection.c b/os/connection.c
index a45a252a5..07c16eacf 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -1084,10 +1084,12 @@ set_poll_client(ClientPtr client)
 {
     OsCommPtr oc = (OsCommPtr) client->osPrivate;
 
-    if (listen_to_client(client))
-        ospoll_listen(server_poll, oc->fd, X_NOTIFY_READ);
-    else
-        ospoll_mute(server_poll, oc->fd, X_NOTIFY_READ);
+    if (oc->trans_conn) {
+        if (listen_to_client(client))
+            ospoll_listen(server_poll, oc->trans_conn->fd, X_NOTIFY_READ);
+        else
+            ospoll_mute(server_poll, oc->trans_conn->fd, X_NOTIFY_READ);
+    }
 }
 
 static void
-- 
2.11.0



More information about the xorg-devel mailing list