From: Todd C. Miller Date: Thu, 20 Mar 2003 02:04:32 +0000 (+0000) Subject: Fix boolean thinko in SIGCHLD reaper and call reapchild after sending X-Git-Tag: SUDO_1_6_7~19 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a7d746af2d5d54ebc0bffc347f612864f1ddcde5;p=sudo Fix boolean thinko in SIGCHLD reaper and call reapchild after sending mail instead of doing a conditional sudo_waitpid. --- diff --git a/logging.c b/logging.c index 4a087cc9b..3baa1a81d 100644 --- a/logging.c +++ b/logging.c @@ -547,10 +547,8 @@ send_mail(line) get_timestr(), user_name, line); fclose(mail); - /* If mailer is done, wait for it now. If not reapchild will get it. */ -#ifdef sudo_waitpid - (void) sudo_waitpid(pid, &status, WNOHANG); -#endif + /* If mailer is done, wait for it now. If not, we'll get it later. */ + reapchild(SIGCHLD); (void) sigprocmask(SIG_SETMASK, &oset, NULL); } @@ -592,7 +590,7 @@ reapchild(sig) int status, serrno = errno; #ifdef sudo_waitpid - while (sudo_waitpid(-1, &status, WNOHANG) != -1 && errno == EINTR) + while (sudo_waitpid(-1, &status, WNOHANG) != -1 || errno == EINTR) ; #else (void) wait(&status);