From: Todd C. Miller Date: Thu, 20 May 2010 21:34:53 +0000 (-0400) Subject: Move check for maxfd == -1 to flush_output where it belongs. X-Git-Tag: SUDO_1_8_0~613 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a9a16d73310d96e318ad9f395879837aa5688018;p=sudo Move check for maxfd == -1 to flush_output where it belongs. --- diff --git a/src/script.c b/src/script.c index fd60afe27..dd3baf2a2 100644 --- a/src/script.c +++ b/src/script.c @@ -1122,8 +1122,6 @@ script_child(const char *path, char *argv[], char *envp[], int backchannel, int if (errpipe[0] != -1) FD_SET(errpipe[0], fdsr); maxfd = MAX(errpipe[0], backchannel); - if (maxfd == -1) - goto done; if (recvsig[SIGCHLD]) continue; @@ -1201,6 +1199,8 @@ flush_output(struct io_buffer *iobufs) if (iob->wfd > maxfd) maxfd = iob->wfd; } + if (maxfd == -1) + return; fdsr = (fd_set *)emalloc2(howmany(maxfd + 1, NFDBITS), sizeof(fd_mask)); fdsw = (fd_set *)emalloc2(howmany(maxfd + 1, NFDBITS), sizeof(fd_mask));