From 2bfe7a1198ae20e8c58a7ef7fb5a9d16e0ddbaf8 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sun, 5 Jul 2009 18:56:06 -0400 Subject: [PATCH] Don't log out player when update aborts a command under Windows pthread.c's empth_select() returned 1 instead of 0 when empth_wakeup() interrupted select(). This made io_input() attempt to read input, which failed with WSAEWOULDBLOCK. The failure then got propagated all the way up, and the player got logged out. Fix by returning 0 in that case. --- src/lib/empthread/ntthread.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lib/empthread/ntthread.c b/src/lib/empthread/ntthread.c index a7509629d..17d4b53f9 100644 --- a/src/lib/empthread/ntthread.c +++ b/src/lib/empthread/ntthread.c @@ -568,6 +568,10 @@ empth_select(int fd, int flags, struct timeval *timeout) result = WSAWaitForMultipleEvents(2, hEventObject, FALSE, msec, FALSE); switch (result) { + case WSA_WAIT_EVENT_0: + res = 1; + break; + case WSA_WAIT_EVENT_0 + 1: case WSA_WAIT_TIMEOUT: res = 0; break; @@ -576,7 +580,9 @@ empth_select(int fd, int flags, struct timeval *timeout) res = -1; break; default: - res = 1; + CANT_REACH(); + errno = EINVAL; + res = -1; } WSAEventSelect(handle, hEventObject[0], 0); -- 2.43.0