]> git.pond.sub.org Git - empserver/commitdiff
Fix Windows client for EOF on stdin
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 11 Apr 2009 15:56:21 +0000 (17:56 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Sat, 11 Apr 2009 15:57:36 +0000 (17:57 +0200)
stdin_read_thread() went into a tight loop on EOF.  Observed with
Wine.  Broken in commit f082ef9f, v4.3.11.

src/client/play.c

index 5d1b63db25df5b3747505c17ebf8181d08e7c38c..da43e609d1b35d5a8ea9d9768301721b54b17c26 100644 (file)
@@ -136,21 +136,15 @@ static DWORD WINAPI
 stdin_read_thread(LPVOID lpParam)
 {
     for (;;) {
-       if (WaitForSingleObject(bounce_empty, INFINITE) != WAIT_OBJECT_0)
-           break;
-       bounce_status = _read(0, bounce_buf, sizeof(bounce_buf));
-       bounce_error = errno;
-       if (bounce_status == 0) {
-           if (_isatty(0)) {
-               SetEvent(bounce_empty);
-               continue;
-           } else
-               break;
+       if (WaitForSingleObject(bounce_empty, INFINITE) != WAIT_OBJECT_0) {
+           bounce_status = 0;
+           bounce_error = GetLastError();
+       } else {
+           bounce_status = _read(0, bounce_buf, sizeof(bounce_buf));
+           bounce_error = errno;
        }
        SetEvent(bounce_full);
     }
-    SetEvent(bounce_full);
-    return 0;
 }
 
 /*