Loop around waitpid in client, from Azat Khuzhin.

This commit is contained in:
nicm 2023-07-10 09:35:46 +00:00
parent 8b3e2eab5a
commit 4ece43a029

View File

@ -526,11 +526,22 @@ client_signal(int sig)
{ {
struct sigaction sigact; struct sigaction sigact;
int status; int status;
pid_t pid;
log_debug("%s: %s", __func__, strsignal(sig)); log_debug("%s: %s", __func__, strsignal(sig));
if (sig == SIGCHLD) if (sig == SIGCHLD) {
waitpid(WAIT_ANY, &status, WNOHANG); for (;;) {
else if (!client_attached) { pid = waitpid(WAIT_ANY, &status, WNOHANG);
if (pid == 0)
break;
if (pid == -1) {
if (errno == ECHILD)
break;
log_debug("waitpid failed: %s",
strerror(errno));
}
}
} else if (!client_attached) {
if (sig == SIGTERM || sig == SIGHUP) if (sig == SIGTERM || sig == SIGHUP)
proc_exit(client_proc); proc_exit(client_proc);
} else { } else {