summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2014-10-01 23:23:20 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2014-10-01 23:23:20 +0000
commit11cd5eb8641dc67f6f51455f910bd63c02f0cf09 (patch)
treef180202e8aa8a38241e75443d16b2739ad0d172d
parent5b12d5968a9a4df3a31408d5ccf48bfe09abef66 (diff)
Call waitpid on SIGCHLD even if client not attached, it is possible (on
very slow platforms) for the first daemon() child to still be running when client_attached is set so we end up with a zombie. From J Raynor.
-rw-r--r--usr.bin/tmux/client.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/usr.bin/tmux/client.c b/usr.bin/tmux/client.c
index 61b5f11ea47..5344f78051e 100644
--- a/usr.bin/tmux/client.c
+++ b/usr.bin/tmux/client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: client.c,v 1.83 2014/09/01 21:50:18 nicm Exp $ */
+/* $OpenBSD: client.c,v 1.84 2014/10/01 23:23:19 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -433,15 +433,11 @@ client_signal(int sig, unused short events, unused void *data)
struct sigaction sigact;
int status;
- if (!client_attached) {
- switch (sig) {
- case SIGCHLD:
- waitpid(WAIT_ANY, &status, WNOHANG);
- break;
- case SIGTERM:
+ if (sig == SIGCHLD)
+ waitpid(WAIT_ANY, &status, WNOHANG);
+ else if (!client_attached) {
+ if (sig == SIGTERM)
event_loopexit(NULL);
- break;
- }
} else {
switch (sig) {
case SIGHUP: