From 21fccfa0451ba59fba479e439465da9c360353d3 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 8 Jul 2021 10:00:30 -0700 Subject: [PATCH] select: port better to MinGW Problem reported by Eli Zaretskii in: https://lists.gnu.org/r/bug-gnulib/2021-07/msg00017.html * lib/select.c (rpl_select) [_WIN32 && !__CYGWIN__]: Pass a SOCKET, not a HANDLE, to FD_ISSET. --- ChangeLog | 8 ++++++++ lib/select.c | 9 +++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2eaf00b591..25d85aa4af 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2021-07-08 Paul Eggert + + select: port better to MinGW + Problem reported by Eli Zaretskii in: + https://lists.gnu.org/r/bug-gnulib/2021-07/msg00017.html + * lib/select.c (rpl_select) [_WIN32 && !__CYGWIN__]: + Pass a SOCKET, not a HANDLE, to FD_ISSET. + 2021-07-06 Paul Eggert year2038: Add --disable-year2038 option diff --git a/lib/select.c b/lib/select.c index 2fe6a18064..eddac4b61f 100644 --- a/lib/select.c +++ b/lib/select.c @@ -530,12 +530,13 @@ restart: if (h != handle_array[nhandles]) { /* Perform handle->descriptor mapping. */ - WSAEventSelect ((SOCKET) h, NULL, 0); - if (FD_ISSET (h, &handle_rfds)) + SOCKET s = (SOCKET) h; + WSAEventSelect (s, NULL, 0); + if (FD_ISSET (s, &handle_rfds)) FD_SET (i, rfds); - if (FD_ISSET (h, &handle_wfds)) + if (FD_ISSET (s, &handle_wfds)) FD_SET (i, wfds); - if (FD_ISSET (h, &handle_xfds)) + if (FD_ISSET (s, &handle_xfds)) FD_SET (i, xfds); } else -- 2.39.5