From af2928d3162485337cb0372f40d6c82cdd25f982 Mon Sep 17 00:00:00 2001 From: Jean-Francois Simoneau Date: Mon, 15 Jan 2024 08:27:31 -0500 Subject: [PATCH] Fix select() return code for fd >= 1024 (#1757) --- httplib.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/httplib.h b/httplib.h index e6f6fa8..1bb4677 100644 --- a/httplib.h +++ b/httplib.h @@ -2793,7 +2793,7 @@ inline ssize_t select_read(socket_t sock, time_t sec, time_t usec) { return handle_EINTR([&]() { return poll(&pfd_read, 1, timeout); }); #else #ifndef _WIN32 - if (sock >= FD_SETSIZE) { return 1; } + if (sock >= FD_SETSIZE) { return -1; } #endif fd_set fds; @@ -2821,7 +2821,7 @@ inline ssize_t select_write(socket_t sock, time_t sec, time_t usec) { return handle_EINTR([&]() { return poll(&pfd_read, 1, timeout); }); #else #ifndef _WIN32 - if (sock >= FD_SETSIZE) { return 1; } + if (sock >= FD_SETSIZE) { return -1; } #endif fd_set fds;