diff options
| author | Jörg Frings-Fürst <debian@jff.email> | 2026-03-08 17:28:33 +0100 |
|---|---|---|
| committer | Jörg Frings-Fürst <debian@jff.email> | 2026-03-08 17:28:33 +0100 |
| commit | 5f59a34ab747dde8ede7357f3431bf06bd6002fe (patch) | |
| tree | 056a4477fd870d454d5be5868cddab829a47f4d2 /tests/pselect.c | |
| parent | 27dae84ed92f1ef0300263091972338d12e78348 (diff) | |
New upstream version 1.4.2upstream/1.4.2upstream
Diffstat (limited to 'tests/pselect.c')
| -rw-r--r-- | tests/pselect.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/tests/pselect.c b/tests/pselect.c index 78f0446f..0e6cff42 100644 --- a/tests/pselect.c +++ b/tests/pselect.c @@ -1,6 +1,6 @@ /* pselect - synchronous I/O multiplexing - Copyright 2011-2025 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)) |
