summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2003-06-09 20:09:10 +0000
committermillert <millert@openbsd.org>2003-06-09 20:09:10 +0000
commit865d523421a5b816d66393cc64009c29d51b0835 (patch)
treedad2878bda22ea9be1ef08be74587e6157cb1ed2
parentMention that you can get EPERM when trying to mount an unclean filesystem. (diff)
downloadwireguard-openbsd-865d523421a5b816d66393cc64009c29d51b0835.tar.xz
wireguard-openbsd-865d523421a5b816d66393cc64009c29d51b0835.zip
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.
-rw-r--r--usr.bin/sudo/logging.c8
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