aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKartik Naik <kartik@bugqore.com>2026-07-14 14:18:48 +0530
committerKartik Naik <kartik@bugqore.com>2026-07-14 14:18:48 +0530
commit991c2d765dc003e43b8814dc191b9e81140df4cd (patch)
treec9a40bac1790b81ac95fc9e3e8a2fe70dede90e6
parent5d8cd43d9b733e5774c2646820632b38dfa0e9f2 (diff)
downloadportable-991c2d765dc003e43b8814dc191b9e81140df4cd.tar.gz
portable-991c2d765dc003e43b8814dc191b9e81140df4cd.tar.bz2
portable-991c2d765dc003e43b8814dc191b9e81140df4cd.zip
honor the requested timeout in the win32 poll shim
-rw-r--r--apps/openssl/compat/poll_win.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/apps/openssl/compat/poll_win.c b/apps/openssl/compat/poll_win.c
index 30f6b60..c518962 100644
--- a/apps/openssl/compat/poll_win.c
+++ b/apps/openssl/compat/poll_win.c
@@ -249,8 +249,6 @@ poll(struct pollfd *pfds, nfds_t nfds, int timeout_ms)
249 wait_rc = WAIT_FAILED; 249 wait_rc = WAIT_FAILED;
250 250
251 looptime_ms = (timeout_ms > 100 || timeout_ms == -1) ? 100 : timeout_ms; 251 looptime_ms = (timeout_ms > 100 || timeout_ms == -1) ? 100 : timeout_ms;
252 if (timeout_ms == -1)
253 timeout_ms = INFINITE;
254 252
255 do { 253 do {
256 TIMEVAL tv; 254 TIMEVAL tv;
@@ -280,7 +278,7 @@ poll(struct pollfd *pfds, nfds_t nfds, int timeout_ms)
280 /* 278 /*
281 * If we signaled on a file handle, don't wait on the sockets. 279 * If we signaled on a file handle, don't wait on the sockets.
282 */ 280 */
283 if (wait_rc >= WAIT_OBJECT_0 && 281 if (num_handles && wait_rc >= WAIT_OBJECT_0 &&
284 (wait_rc <= WAIT_OBJECT_0 + num_handles - 1)) { 282 (wait_rc <= WAIT_OBJECT_0 + num_handles - 1)) {
285 tv.tv_usec = 0; 283 tv.tv_usec = 0;
286 handle_signaled = 1; 284 handle_signaled = 1;
@@ -298,7 +296,7 @@ poll(struct pollfd *pfds, nfds_t nfds, int timeout_ms)
298 296
299 timespent_ms += looptime_ms; 297 timespent_ms += looptime_ms;
300 298
301 } while (timespent_ms < timeout_ms); 299 } while (timeout_ms == -1 || timespent_ms < timeout_ms);
302 300
303 rc = 0; 301 rc = 0;
304 num_handles = 0; 302 num_handles = 0;