summaryrefslogtreecommitdiffstats
path: root/client.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2023-07-10 12:01:12 +0100
committerThomas Adam <thomas@xteddy.org>2023-07-10 12:01:12 +0100
commit269dab4b3e593ade4995ebbcb428025f51c542fd (patch)
tree57f59066a9526c6bcf59ef24a58ac562cd3bdeb6 /client.c
parente4c4ceb2865fd9d2006a85c7f48bb7b6dd2f5c49 (diff)
parent4ece43a02961dc6726e97b05caca9a3c53793826 (diff)
Merge branch 'obsd-master'
Diffstat (limited to 'client.c')
-rw-r--r--client.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/client.c b/client.c
index 374c1146..78bf8ab8 100644
--- a/client.c
+++ b/client.c
@@ -533,11 +533,22 @@ client_signal(int sig)
{
struct sigaction sigact;
int status;
+ pid_t pid;
log_debug("%s: %s", __func__, strsignal(sig));
- if (sig == SIGCHLD)
- waitpid(WAIT_ANY, &status, WNOHANG);
- else if (!client_attached) {
+ if (sig == SIGCHLD) {
+ for (;;) {
+ 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)
proc_exit(client_proc);
} else {