diff --git a/logging.c b/logging.c index f9967f09e..2725556a7 100644 --- a/logging.c +++ b/logging.c @@ -536,9 +536,15 @@ static void send_mail() static RETSIGTYPE reapchild(sig) int sig; { - int save_errno = errno; + int pid, status, save_errno = errno; +#ifdef sudo_waitpid + do { + pid = sudo_waitpid(-1, &status, WNOHANG); + } while (pid == -1); +#else (void) wait(NULL); +#endif #ifndef POSIX_SIGNALS (void) signal(SIGCHLD, reapchild); #endif /* POSIX_SIGNALS */