changeset 3890:271ca53950e6

[gaim-migrate @ 4042] reap ALL children who are done instead of a single child. we used to do this before sean removed the child-reaper jseymour and i worked out. thanks Paco-Paco committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Sun, 03 Nov 2002 21:59:05 +0000
parents 811329c423ca
children a611ec77d1d2
files src/util.c
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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);