diff options
author | marha <marha@users.sourceforge.net> | 2010-09-19 18:55:31 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2010-09-19 18:55:31 +0000 |
commit | 1845686fa00493ca3a9667b330066300ff900323 (patch) | |
tree | 12f5f87bcca81e93abcb3f856afbb81418a80242 /xorg-server/os/connection.c | |
parent | f234d2f845843ad7b6c02eb69dae22bd257afeb5 (diff) | |
download | vcxsrv-1845686fa00493ca3a9667b330066300ff900323.tar.gz vcxsrv-1845686fa00493ca3a9667b330066300ff900323.tar.bz2 vcxsrv-1845686fa00493ca3a9667b330066300ff900323.zip |
Make sure that both AllClients and AllSockets contain valid sockets in checkconnections
Diffstat (limited to 'xorg-server/os/connection.c')
-rw-r--r-- | xorg-server/os/connection.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/xorg-server/os/connection.c b/xorg-server/os/connection.c index cc3873f9a..24632f1c0 100644 --- a/xorg-server/os/connection.c +++ b/xorg-server/os/connection.c @@ -1008,7 +1008,8 @@ CheckConnections(void) struct timeval notime;
int r;
#ifdef WIN32
- fd_set savedAllClients;
+ fd_set savedAllSockets;
+ unsigned j;
#endif
notime.tv_sec = 0;
@@ -1034,19 +1035,23 @@ CheckConnections(void) }
}
#else
- XFD_COPYSET(&AllClients, &savedAllClients);
- for (i = 0; i < XFD_SETCOUNT(&savedAllClients); i++)
+ XFD_COPYSET(&AllSockets, &savedAllSockets);
+ for (j=0; j<2; j++)
{
- curclient = XFD_FD(&savedAllClients, i);
- FD_ZERO(&tmask);
- FD_SET(curclient, &tmask);
- do {
- r = Select (curclient + 1, &tmask, NULL, NULL, ¬ime);
- } while (r < 0 && (errno == EINTR || errno == EAGAIN));
- if (r < 0)
- if (GetConnectionTranslation(curclient) > 0)
- CloseDownClient(clients[GetConnectionTranslation(curclient)]);
- }
+ for (i = 0; i < XFD_SETCOUNT(&savedAllSockets); i++)
+ {
+ curclient = XFD_FD(&savedAllSockets, i);
+ FD_ZERO(&tmask);
+ FD_SET(curclient, &tmask);
+ do {
+ r = Select (curclient + 1, &tmask, NULL, NULL, ¬ime);
+ } while (r < 0 && (WSAGetLastError() == WSAEINTR || WSAGetLastError() == WSAEWOULDBLOCK));
+ if (r < 0)
+ if (GetConnectionTranslation(curclient) > 0)
+ CloseDownClient(clients[GetConnectionTranslation(curclient)]);
+ }
+ XFD_COPYSET(&AllClients, &savedAllSockets);
+ }
#endif
}
|