1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 01:48:00 +00:00

Another signal-handling refinement from RJK: the SIGCHLD handler

should be prepared to reap more than one child per invocation if
necessary, since we do after all have two.

[originally from svn r2183]
This commit is contained in:
Simon Tatham 2002-11-02 16:05:26 +00:00
parent 53eb272766
commit d6739ada35

View File

@ -168,11 +168,13 @@ static void sigchld_handler(int signum)
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;
}