summaryrefslogtreecommitdiff
path: root/tests/pselect.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2026-03-10 13:24:07 +0100
committerJörg Frings-Fürst <debian@jff.email>2026-03-10 13:24:07 +0100
commitcfd1f17f1a85d95ea12bca8dae42add7dad1ad11 (patch)
tree8016486f8ee7157213f2d09ff2491bfa9c94638a /tests/pselect.c
parent14e4d584d0121031ec40e6c35869745f1747ff29 (diff)
parent1403307d6e2fb4e7b5d97a35f40d1e95134561ab (diff)
Merge branch 'release/debian/1.4.2-1'HEADdebian/1.4.2-1master
Diffstat (limited to 'tests/pselect.c')
-rw-r--r--tests/pselect.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/tests/pselect.c b/tests/pselect.c
index 54732e5c..0e6cff42 100644
--- a/tests/pselect.c
+++ b/tests/pselect.c
@@ -1,6 +1,6 @@
/* pselect - synchronous I/O multiplexing
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2026 Free Software Foundation, Inc.
This file is part of gnulib.
@@ -41,16 +41,14 @@ pselect (int nfds, fd_set *restrict rfds,
struct timespec const *restrict timeout,
sigset_t const *restrict sigmask)
{
- int select_result;
- sigset_t origmask;
- struct timeval tv, *tvp;
-
if (nfds < 0 || nfds > FD_SETSIZE)
{
errno = EINVAL;
return -1;
}
+ struct timeval tv;
+ struct timeval *tvp;
if (timeout)
{
if (! (0 <= timeout->tv_nsec && timeout->tv_nsec < 1000000000))
@@ -68,12 +66,13 @@ pselect (int nfds, fd_set *restrict rfds,
else
tvp = NULL;
+ sigset_t origmask;
/* Signal mask munging should be atomic, but this is the best we can
do in this emulation. */
if (sigmask)
pthread_sigmask (SIG_SETMASK, sigmask, &origmask);
- select_result = select (nfds, rfds, wfds, xfds, tvp);
+ int select_result = select (nfds, rfds, wfds, xfds, tvp);
if (sigmask)
{
@@ -95,15 +94,13 @@ rpl_pselect (int nfds, fd_set *restrict rfds,
struct timespec const *restrict timeout,
sigset_t const *restrict sigmask)
{
- int i;
-
/* FreeBSD 8.2 has a bug: it does not always detect invalid fds. */
if (nfds < 0 || nfds > FD_SETSIZE)
{
errno = EINVAL;
return -1;
}
- for (i = 0; i < nfds; i++)
+ for (int i = 0; i < nfds; i++)
{
if (((rfds && FD_ISSET (i, rfds))
|| (wfds && FD_ISSET (i, wfds))