From b7ffbb17e37f59249c31f1ff59d6c5d80888f689 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Fri, 19 Nov 2021 18:53:46 +1100 Subject: [PATCH] Allow for fd = -1 in compat ppoll overflow check. Fixes tests on at least FreeBSD 6, possibly others. --- openbsd-compat/bsd-poll.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openbsd-compat/bsd-poll.c b/openbsd-compat/bsd-poll.c index b661c030e..faef8343b 100644 --- a/openbsd-compat/bsd-poll.c +++ b/openbsd-compat/bsd-poll.c @@ -50,7 +50,7 @@ ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *tmoutp, for (i = 0; i < nfds; i++) { fd = fds[i].fd; - if (fd >= FD_SETSIZE) { + if (fd != -1 && fd >= FD_SETSIZE) { errno = EINVAL; return -1; }