diff options
author | Bruno Haible <bruno@clisp.org> | 2023-04-24 21:28:32 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2023-04-24 21:33:23 +0200 |
commit | 034af0e401ce3279afd444c09ded2d64142b0f2f (patch) | |
tree | 0c461d81dd825dae7a6cb212202eeda73935a835 /lib/select.c | |
parent | 4bb14d69493fd3bbc328b86755420892a88d3fd8 (diff) | |
download | gnulib-034af0e401ce3279afd444c09ded2d64142b0f2f.tar.gz |
select, pselect: Fix test failure on native Windows.
* lib/select.c (rpl_select): Fail if nfds is out-of-range.
* lib/pselect.c (pselect): Likewise.
Diffstat (limited to 'lib/select.c')
-rw-r--r-- | lib/select.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/select.c b/lib/select.c index 3d3efff3de..6b6ca4154c 100644 --- a/lib/select.c +++ b/lib/select.c @@ -279,8 +279,11 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *xfds, int i, fd, rc; clock_t tend; - if (nfds > FD_SETSIZE) - nfds = FD_SETSIZE; + if (nfds < 0 || nfds > FD_SETSIZE) + { + errno = EINVAL; + return -1; + } if (!timeout) wait_timeout = INFINITE; |