]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
select: do not return fatal error on EINTR from poll()
authorThomas Weißschuh <thomas@t-8ch.de>
Sun, 3 Jul 2022 16:20:44 +0000 (18:20 +0200)
committerJay Satiro <raysatiro@yahoo.com>
Mon, 4 Jul 2022 04:58:07 +0000 (00:58 -0400)
The same was done for select() in 5912da25 but poll() was missed.

Bug: https://bugs.archlinux.org/task/75201
Reported-by: Alexandre Bury (gyscos at archlinux)
Ref: https://github.com/curl/curl/issues/8921
Ref: https://github.com/curl/curl/pull/8961
Ref: https://github.com/curl/curl/commit/5912da25#r77584294

Closes https://github.com/curl/curl/pull/9091

lib/select.c

index c16358d56ca50bdd0330d52c345bd26f365a37c9..2ac07467728c601682916aea2d03753d86e789e6 100644 (file)
@@ -310,8 +310,12 @@ int Curl_poll(struct pollfd ufds[], unsigned int nfds, timediff_t timeout_ms)
   else
     pending_ms = 0;
   r = poll(ufds, nfds, pending_ms);
-  if(r <= 0)
+  if(r <= 0) {
+    if((r == -1) && (SOCKERRNO == EINTR))
+      /* make EINTR from select or poll not a "lethal" error */
+      r = 0;
     return r;
+  }
 
   for(i = 0; i < nfds; i++) {
     if(ufds[i].fd == CURL_SOCKET_BAD)