[dovecot-cvs] dovecot/src/auth passdb-pam.c,1.7,1.8

cras at procontrol.fi cras at procontrol.fi
Wed Jun 25 20:39:08 EEST 2003


Update of /home/cvs/dovecot/src/auth
In directory danu:/tmp/cvs-serv24258/auth

Modified Files:
	passdb-pam.c 
Log Message:
Call waitpid() until no processes are left, instead of one per second.



Index: passdb-pam.c
===================================================================
RCS file: /home/cvs/dovecot/src/auth/passdb-pam.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- passdb-pam.c	24 Jun 2003 23:17:06 -0000	1.7
+++ passdb-pam.c	25 Jun 2003 16:39:06 -0000	1.8
@@ -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;
-
-	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));
+		}
 	}
 }
 



More information about the dovecot-cvs mailing list