]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
multi_wait: stop loop when sread() returns zero
authorDaniel Stenberg <daniel@haxx.se>
Mon, 2 Mar 2020 09:38:53 +0000 (10:38 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 2 Mar 2020 14:45:05 +0000 (15:45 +0100)
It's unclear why it would ever return zero here, but this change fixes
Robert's problem and it shouldn't loop forever...

Reported-by: Robert Dunaj
Bug: https://curl.haxx.se/mail/archive-2020-02/0011.html
Closes #5019

lib/multi.c

index ef86f7c22fa5584be0005f21c70cb7291f2587c0..cef2805c8edfdab8a930e6b29912e4bc5c69ffd2 100644 (file)
@@ -1199,7 +1199,7 @@ static CURLMcode Curl_multi_wait(struct Curl_multi *multi,
                data from it until it receives an error (except EINTR).
                In normal cases it will get EAGAIN or EWOULDBLOCK
                when there is no more data, breaking the loop. */
-            if(sread(multi->wakeup_pair[0], buf, sizeof(buf)) < 0) {
+            if(sread(multi->wakeup_pair[0], buf, sizeof(buf)) <= 0) {
 #ifndef USE_WINSOCK
               if(EINTR == SOCKERRNO)
                 continue;