[PATCH 1/2] OS support: fix writeable client vs IgnoreClient behavior

Jesse Barnes jbarnes at virtuousgeek.org
Mon Jun 28 15:58:46 PDT 2010


When ResetCurrentRequest is called, or IgnoreClient is called when a
client has input pending, IgnoredClientsWithInput will be set.  However,
a subsequent IgnoreClient request will clear the client fd from that fd
set, potentially causing the client to hang.

So leave the client fd bit in IgnoredClientsWithInput set if needed and
clear it in AttendClient if we used it.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=27035.

Signed-off-by: Jesse Barnes <jbarnes at virtuousgeek.org>
---
 os/connection.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/os/connection.c b/os/connection.c
index 61ba72a..a3665b1 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -1152,8 +1152,6 @@ IgnoreClient (ClientPtr client)
     {
     	if (FD_ISSET (connection, &ClientsWithInput))
 	    FD_SET(connection, &IgnoredClientsWithInput);
-    	else
-	    FD_CLR(connection, &IgnoredClientsWithInput);
     	FD_CLR(connection, &ClientsWithInput);
     	FD_CLR(connection, &AllSockets);
     	FD_CLR(connection, &AllClients);
@@ -1163,8 +1161,6 @@ IgnoreClient (ClientPtr client)
     {
     	if (FD_ISSET (connection, &SavedClientsWithInput))
 	    FD_SET(connection, &IgnoredClientsWithInput);
-    	else
-	    FD_CLR(connection, &IgnoredClientsWithInput);
 	FD_CLR(connection, &SavedClientsWithInput);
 	FD_CLR(connection, &SavedAllSockets);
 	FD_CLR(connection, &SavedAllClients);
@@ -1187,15 +1183,19 @@ AttendClient (ClientPtr client)
     	FD_SET(connection, &AllClients);
     	FD_SET(connection, &AllSockets);
 	FD_SET(connection, &LastSelectMask);
-    	if (FD_ISSET (connection, &IgnoredClientsWithInput))
+    	if (FD_ISSET (connection, &IgnoredClientsWithInput)) {
 	    FD_SET(connection, &ClientsWithInput);
+	    FD_CLR(connection, &IgnoredClientsWithInput);
+	}
     }
     else
     {
 	FD_SET(connection, &SavedAllClients);
 	FD_SET(connection, &SavedAllSockets);
-	if (FD_ISSET(connection, &IgnoredClientsWithInput))
+	if (FD_ISSET(connection, &IgnoredClientsWithInput)) {
 	    FD_SET(connection, &SavedClientsWithInput);
+	    FD_CLR(connection, &IgnoredClientsWithInput);
+	}
     }
 }
 
-- 
1.6.6.1



More information about the xorg-devel mailing list