summaryrefslogtreecommitdiffstats
path: root/tmux.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2010-04-18 13:41:29 +0000
committerNicholas Marriott <nicm@openbsd.org>2010-04-18 13:41:29 +0000
commit67dd5df8766720925b3a30543b3e151ae6f3bc7b (patch)
treecfe9fa21505be8a80e0d21f6e2a3860ccf4c37df /tmux.c
parent622593a77f30e9a309c1b2e4979bd961b894c858 (diff)
Catch SIGCHLD to avoid a zombie, from patrick keshishian.
Diffstat (limited to 'tmux.c')
-rw-r--r--tmux.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/tmux.c b/tmux.c
index 4f0a9090..9feeb300 100644
--- a/tmux.c
+++ b/tmux.c
@@ -238,6 +238,7 @@ main(int argc, char **argv)
struct keylist *keylist;
struct env_data envdata;
struct msg_command_data cmddata;
+ struct sigaction sigact;
char *s, *shellcmd, *path, *label, *home, *cause;
char cwd[MAXPATHLEN], **var;
void *buf;
@@ -537,6 +538,14 @@ main(int argc, char **argv)
exit(1);
}
+ /* Catch SIGCHLD to avoid a zombie when starting the server. */
+ memset(&sigact, 0, sizeof sigact);
+ sigemptyset(&sigact.sa_mask);
+ sigact.sa_handler = SIG_IGN;
+ if (sigaction(SIGCHLD, &sigact, NULL) != 0)
+ fatal("sigaction failed");
+
+ /* Initialise the client socket/start the server. */
if ((main_ibuf = client_init(path, cmdflags, flags)) == NULL)
exit(1);
xfree(path);