]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tool_cb_rea: make waitfd() return void
authorDaniel Stenberg <daniel@haxx.se>
Fri, 27 Mar 2026 16:02:29 +0000 (17:02 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Sat, 28 Mar 2026 22:00:42 +0000 (23:00 +0100)
Nothing cared about the return code. Simplified.

Closes #21127

src/tool_cb_rea.c

index eb23f9b907be53e106db188288f0025971daa45c..a818d0804d64e4854b0c198e4c2bef39b08ae202 100644 (file)
@@ -41,7 +41,7 @@
 /* Wait up to a number of milliseconds for socket activity. This function
    waits on read activity on a file descriptor that is not a socket which
    makes it not work with select() or poll() on Windows. */
-static bool waitfd(int waitms, int fd)
+static void waitfd(int waitms, int fd)
 {
 #ifdef HAVE_POLL
   struct pollfd set;
@@ -49,25 +49,20 @@ static bool waitfd(int waitms, int fd)
   set.fd = fd;
   set.events = POLLIN;
   set.revents = 0;
-  if(poll(&set, 1, waitms))
-    return TRUE; /* timeout */
-  return FALSE;
+  poll(&set, 1, waitms);
 #else
   fd_set bits;
   struct timeval timeout;
 
-  if(fd >= FD_SETSIZE)
-    return FALSE; /* cannot wait! */
+  if(fd < FD_SETSIZE) {
+    /* wait this long at the most */
+    timeout.tv_sec = waitms / 1000;
+    timeout.tv_usec = (int)((waitms % 1000) * 1000);
 
-  /* wait this long at the most */
-  timeout.tv_sec = waitms / 1000;
-  timeout.tv_usec = (int)((waitms % 1000) * 1000);
-
-  FD_ZERO(&bits);
-  FD_SET(fd, &bits);
-  if(!select(fd + 1, &bits, NULL, NULL, &timeout))
-    return TRUE; /* timeout */
-  return FALSE;
+    FD_ZERO(&bits);
+    FD_SET(fd, &bits);
+    select(fd + 1, &bits, NULL, NULL, &timeout);
+  }
 #endif
 }
 #endif