should be prepared to reap more than one child per invocation if
necessary, since we do after all have two.
git-svn-id: svn://svn.tartarus.org/sgt/putty@2183
cda61777-01e9-0310-a592-
d414129be87e
pid_t pid;
int status;
- pid = waitpid(-1, &status, WNOHANG);
- if (pid == pty_child_pid && (WIFEXITED(status) || WIFSIGNALED(status))) {
- pty_exit_code = status;
- pty_child_dead = TRUE;
- }
+ do {
+ pid = waitpid(-1, &status, WNOHANG);
+ if (pid == pty_child_pid && (WIFEXITED(status) || WIFSIGNALED(status))) {
+ pty_exit_code = status;
+ pty_child_dead = TRUE;
+ }
+ } while(pid > 0);
errno = save_errno;
}