]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
Increment nfds when coming from startup_pipe. V_8_7 anongit/V_8_7 github-selfhosted/V_8_7 github/V_8_7
authorDarren Tucker <dtucker@dtucker.net>
Wed, 8 Sep 2021 08:39:44 +0000 (18:39 +1000)
committerDarren Tucker <dtucker@dtucker.net>
Wed, 8 Sep 2021 08:44:45 +0000 (18:44 +1000)
If we have to increase nfds because startup_pipe[0] is above any of the
descriptors passed in the fd_sets, we also need to add 1 to nfds since
select takes highest FD number plus one.  bz#3345 from yaroslav.kuzmin
at vmssoftware.com.

openbsd-compat/bsd-pselect.c

index fff1bf54f72c2e06acfa85ac03b93980b7405b04..b3632086368a6b5cc639a8e57c2d08006af440f4 100644 (file)
@@ -188,7 +188,7 @@ pselect(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
        if (unmasked) {
                pselect_notify_setup();
                pselect_notify_prepare(readfds);
-               nfds = MAX(nfds, notify_pipe[0]);
+               nfds = MAX(nfds, notify_pipe[0] + 1);
        }
 
        /* Unmask signals, call select then restore signal mask. */