]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
select: avoid returning an error on EINTR from select() or poll()
authorAntoine Pitrou <antoine@python.org>
Thu, 18 May 2023 19:39:05 +0000 (21:39 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 19 May 2023 14:16:26 +0000 (16:16 +0200)
This was already done for the poll() and select() calls
made directly from Curl_poll(), but was missed in
Curl_wait_ms(), which is called when there are no fds
to wait on.

Fixes #11135
Closes #11143

lib/select.c

index 61cce619b485f78d16e3ce5312215a4677980e3f..cae9beb6c7c977df5b0fe4fc3da750d6507553ab 100644 (file)
@@ -61,8 +61,8 @@
  * for the intended use of this function in the library.
  *
  * Return values:
- *   -1 = system call error, invalid timeout value, or interrupted
- *    0 = specified timeout has elapsed
+ *   -1 = system call error, or invalid timeout value
+ *    0 = specified timeout has elapsed, or interrupted
  */
 int Curl_wait_ms(timediff_t timeout_ms)
 {
@@ -99,8 +99,13 @@ int Curl_wait_ms(timediff_t timeout_ms)
   }
 #endif /* HAVE_POLL_FINE */
 #endif /* USE_WINSOCK */
-  if(r)
-    r = -1;
+  if(r) {
+    if((r == -1) && (SOCKERRNO == EINTR))
+      /* make EINTR from select or poll not a "lethal" error */
+      r = 0;
+    else
+      r = -1;
+  }
   return r;
 }