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);
}
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);