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.
This commit is contained in:
@@ -592,10 +592,12 @@ reapchild(sig)
|
|||||||
int sig;
|
int sig;
|
||||||
{
|
{
|
||||||
int status, serrno = errno;
|
int status, serrno = errno;
|
||||||
|
|
||||||
#ifdef sudo_waitpid
|
#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
|
#else
|
||||||
(void) wait(&status);
|
(void) wait(&status);
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user