comparison src/util.c @ 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 43e396e94095
children a611ec77d1d2
comparison
equal deleted inserted replaced
3889:811329c423ca 3890:271ca53950e6
646 { 646 {
647 #ifndef _WIN32 647 #ifndef _WIN32
648 int status; 648 int status;
649 pid_t pid; 649 pid_t pid;
650 650
651 pid = waitpid(-1, &status, 0); 651 do {
652 if(pid < 0 && errno != ECHILD) { 652 pid = waitpid(-1, &status, WNOHANG);
653 } while (pid > 0);
654 if(pid == (pid_t)-1 && errno != ECHILD) {
653 char errmsg[BUFSIZ]; 655 char errmsg[BUFSIZ];
654 sprintf(errmsg, "Warning: waitpid() returned %d", pid); 656 sprintf(errmsg, "Warning: waitpid() returned %d", pid);
655 perror(errmsg); 657 perror(errmsg);
656 } 658 }
657 #endif 659 #endif