diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2003-06-09 20:09:11 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2003-06-09 20:09:11 +0000 |
commit | 8a2bfd38285c8fe3333b7fbbfe520879d5d720cf (patch) | |
tree | b5333504ef77b4adfcaf60a0344a800e6109233c /usr.bin | |
parent | 8a816c80ee463a5e1d3202ada3375c9bae77c256 (diff) |
Also exit waitpid() loop when pid == 0. Fixes a problem where the sudo
process would spin eating up CPU until sendmail finished when it has
to send mail.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/sudo/logging.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/sudo/logging.c b/usr.bin/sudo/logging.c index 28068fb6e8d..9fd2e1fc6a4 100644 --- a/usr.bin/sudo/logging.c +++ b/usr.bin/sudo/logging.c @@ -592,10 +592,12 @@ reapchild(sig) int sig; { int status, serrno = errno; - #ifdef sudo_waitpid - while (sudo_waitpid(-1, &status, WNOHANG) != -1 || errno == EINTR) - ; + pid_t pid; + + do { + pid = sudo_waitpid(-1, &status, WNOHANG); + } while (pid != 0 && (pid != -1 || errno == EINTR)); #else (void) wait(&status); #endif |