src/util.c

changeset 3890
2db3ae509329
parent 3867
0e747b4295cb
child 3891
af3c412f2fa1
--- a/src/util.c	Sun Nov 03 17:59:27 2002 +0000
+++ b/src/util.c	Sun Nov 03 21:59:05 2002 +0000
@@ -648,8 +648,10 @@
 	int status;
 	pid_t pid;
 
-	pid = waitpid(-1, &status, 0);
-	if(pid < 0 && errno != ECHILD) {
+	do {
+		pid = waitpid(-1, &status, WNOHANG);
+	} while (pid > 0);
+	if(pid == (pid_t)-1 && errno != ECHILD) {
 		char errmsg[BUFSIZ];
 		sprintf(errmsg, "Warning: waitpid() returned %d", pid);
 		perror(errmsg);

mercurial