diff --git a/src/process.c b/src/process.c index 1ab83780914..f4613be28ed 100644 --- a/src/process.c +++ b/src/process.c @@ -4859,6 +4859,10 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, data is available in the buffers manually. */ if (nfds == 0) { + fd_set tls_available; + int set = 0; + + FD_ZERO (&tls_available); if (! wait_proc) { /* We're not waiting on a specific process, so loop @@ -4879,7 +4883,8 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, { nfds++; eassert (p->infd == channel); - FD_SET (p->infd, &Available); + FD_SET (p->infd, &tls_available); + set++; } } } @@ -4896,9 +4901,12 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, nfds = 1; eassert (0 <= wait_proc->infd); /* Set to Available. */ - FD_SET (wait_proc->infd, &Available); + FD_SET (wait_proc->infd, &tls_available); + set++; } } + if (set) + Available = tls_available; } #endif }