summaryrefslogtreecommitdiff
path: root/gl/lib/select.c
diff options
context:
space:
mode:
Diffstat (limited to 'gl/lib/select.c')
-rw-r--r--gl/lib/select.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/gl/lib/select.c b/gl/lib/select.c
index e35746bb..c2424982 100644
--- a/gl/lib/select.c
+++ b/gl/lib/select.c
@@ -1,30 +1,33 @@
/* Emulation for select(2)
Contributed by Paolo Bonzini.
- Copyright 2008-2020 Free Software Foundation, Inc.
+ Copyright 2008-2022 Free Software Foundation, Inc.
This file is part of gnulib.
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
+ This file is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
+ This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with this program; if not, see <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h>
-#include <alloca.h>
-#include <assert.h>
+
+/* Specification. */
+#include <sys/select.h>
#if defined _WIN32 && ! defined __CYGWIN__
/* Native Windows. */
+#include <alloca.h>
+#include <assert.h>
#include <sys/types.h>
#include <errno.h>
#include <limits.h>
@@ -527,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
@@ -553,7 +557,6 @@ restart:
#else /* ! Native Windows. */
-#include <sys/select.h>
#include <stddef.h> /* NULL */
#include <errno.h>
#include <unistd.h>