]> granicus.if.org Git - sudo/commitdiff
Fix boolean thinko in SIGCHLD reaper and call reapchild after sending
authorTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 20 Mar 2003 02:04:32 +0000 (02:04 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 20 Mar 2003 02:04:32 +0000 (02:04 +0000)
mail instead of doing a conditional sudo_waitpid.

logging.c

index 4a087cc9b00315e6c154811964a8707a2bd455d0..3baa1a81d972f75f5e45d2eca84271f297c8c987 100644 (file)
--- 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);