From 00893e79fc62966067af1a106567db96bd170338 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 3 Mar 2024 19:11:32 +0100 Subject: New upstream version 1.2 --- tests/pselect.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'tests/pselect.c') diff --git a/tests/pselect.c b/tests/pselect.c index a1eca0c6..54732e5c 100644 --- a/tests/pselect.c +++ b/tests/pselect.c @@ -1,6 +1,6 @@ /* pselect - synchronous I/O multiplexing - Copyright 2011-2022 Free Software Foundation, Inc. + Copyright 2011-2024 Free Software Foundation, Inc. This file is part of gnulib. @@ -45,6 +45,12 @@ pselect (int nfds, fd_set *restrict rfds, sigset_t origmask; struct timeval tv, *tvp; + if (nfds < 0 || nfds > FD_SETSIZE) + { + errno = EINVAL; + return -1; + } + if (timeout) { if (! (0 <= timeout->tv_nsec && timeout->tv_nsec < 1000000000)) @@ -53,8 +59,10 @@ pselect (int nfds, fd_set *restrict rfds, return -1; } - tv.tv_sec = timeout->tv_sec; - tv.tv_usec = (timeout->tv_nsec + 999) / 1000; + tv = (struct timeval) { + .tv_sec = timeout->tv_sec, + .tv_usec = (timeout->tv_nsec + 999) / 1000 + }; tvp = &tv; } else -- cgit v1.2.3