Mercurial > dovecot > original-hg > dovecot-1.2
changeset 1576:f1711e0f7035 HEAD
Call waitpid() until no processes are left, instead of one per second.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 25 Jun 2003 19:39:06 +0300 |
parents | 37c4985b7dc9 |
children | b3ae1757f921 |
files | src/auth/passdb-pam.c |
diffstat | 1 files changed, 13 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/src/auth/passdb-pam.c Wed Jun 25 02:35:13 2003 +0300 +++ b/src/auth/passdb-pam.c Wed Jun 25 19:39:06 2003 +0300 @@ -301,22 +301,20 @@ pid_t pid; /* FIXME: if we ever do some other kind of forking, this needs fixing */ - pid = waitpid(-1, &status, WNOHANG); - if (pid == 0) - return; + while ((pid = waitpid(-1, &status, WNOHANG)) != 0) { + if (pid == -1) { + if (errno == ECHILD) { + timeout_remove(to_wait); + to_wait = NULL; + } else if (errno != EINTR) + i_error("waitpid() failed: %m"); + return; + } - if (pid == -1) { - if (errno == ECHILD) { - timeout_remove(to_wait); - to_wait = NULL; - } else if (errno != EINTR) - i_error("waitpid() failed: %m"); - return; - } - - if (WIFSIGNALED(status)) { - i_error("PAM: Child %s died with signal %d", - dec2str(pid), WTERMSIG(status)); + if (WIFSIGNALED(status)) { + i_error("PAM: Child %s died with signal %d", + dec2str(pid), WTERMSIG(status)); + } } }