comparison src/util.c @ 3891:a611ec77d1d2

[gaim-migrate @ 4043] this is a better test condition from paco-paco. (17:05:42) Paco-Paco: and you have to check the return value of wait against (pid_t)-1 (17:05:42) Paco-Paco: you *cannot* use < 0 (17:05:45) Paco-Paco: pid_t is unsigned on some systems :-) (17:05:57) Paco-Paco: actually, my patch might need fixed for the while loop (17:05:58) ***Paco-Paco looks (17:07:16) Paco-Paco: LSchiere: actually, I have a one-line fix committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Sun, 03 Nov 2002 22:16:39 +0000
parents 271ca53950e6
children fcc6db86f5c7
comparison
equal deleted inserted replaced
3890:271ca53950e6 3891:a611ec77d1d2
648 int status; 648 int status;
649 pid_t pid; 649 pid_t pid;
650 650
651 do { 651 do {
652 pid = waitpid(-1, &status, WNOHANG); 652 pid = waitpid(-1, &status, WNOHANG);
653 } while (pid > 0); 653 } while (pid != 0 && pid != (pid_t)-1);
654 if(pid == (pid_t)-1 && errno != ECHILD) { 654 if(pid == (pid_t)-1 && errno != ECHILD) {
655 char errmsg[BUFSIZ]; 655 char errmsg[BUFSIZ];
656 sprintf(errmsg, "Warning: waitpid() returned %d", pid); 656 sprintf(errmsg, "Warning: waitpid() returned %d", pid);
657 perror(errmsg); 657 perror(errmsg);
658 } 658 }