]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Call waitpid() until no processes are left, instead of one per second.
authorTimo Sirainen <tss@iki.fi>
Wed, 25 Jun 2003 16:39:06 +0000 (19:39 +0300)
committerTimo Sirainen <tss@iki.fi>
Wed, 25 Jun 2003 16:39:06 +0000 (19:39 +0300)
--HG--
branch : HEAD

src/auth/passdb-pam.c

index 0dd50a87064819e0eafa58dfb015776e89d6780c..1dd43941be0999a1365ddbaee4d2cbced35140bc 100644 (file)
@@ -301,22 +301,20 @@ static void wait_timeout(void *context __attr_unused__)
        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;
-
-       if (pid == -1) {
-               if (errno == ECHILD) {
-                       timeout_remove(to_wait);
-                       to_wait = NULL;
-               } else if (errno != EINTR)
-                       i_error("waitpid() failed: %m");
-               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 (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));
+               }
        }
 }