diff options
author | Tiago Cunha <tcunha@gmx.com> | 2010-05-14 14:35:26 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2010-05-14 14:35:26 +0000 |
commit | 6694a018613fe2822e416a97b6433c2134e7723d (patch) | |
tree | 7150db141bc765f4f3c1e4084927d8f5b198e933 /signal.c | |
parent | 9900e28ba88526eec3ba623ea1ebc94116257c97 (diff) | |
download | rtmux-6694a018613fe2822e416a97b6433c2134e7723d.tar.gz rtmux-6694a018613fe2822e416a97b6433c2134e7723d.tar.bz2 rtmux-6694a018613fe2822e416a97b6433c2134e7723d.zip |
Sync OpenBSD patchset 698:
Catch SIGHUP and terminate if running as a client. This prevents clients
from being left hanging around when, for example, a SSH session is
disconnected.
ok nicm@
Diffstat (limited to 'signal.c')
-rw-r--r-- | signal.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -1,4 +1,4 @@ -/* $Id: signal.c,v 1.1 2010-05-14 14:30:01 tcunha Exp $ */ +/* $Id: signal.c,v 1.2 2010-05-14 14:35:26 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -22,6 +22,7 @@ #include "tmux.h" +struct event ev_sighup; struct event ev_sigchld; struct event ev_sigcont; struct event ev_sigterm; @@ -45,9 +46,9 @@ set_signals(void(*handler)(int, short, unused void *)) fatal("sigaction failed"); if (sigaction(SIGTSTP, &sigact, NULL) != 0) fatal("sigaction failed"); - if (sigaction(SIGHUP, &sigact, NULL) != 0) - fatal("sigaction failed"); + signal_set(&ev_sighup, SIGHUP, handler, NULL); + signal_add(&ev_sighup, NULL); signal_set(&ev_sigchld, SIGCHLD, handler, NULL); signal_add(&ev_sigchld, NULL); signal_set(&ev_sigcont, SIGCONT, handler, NULL); @@ -77,9 +78,8 @@ clear_signals(void) fatal("sigaction failed"); if (sigaction(SIGTSTP, &sigact, NULL) != 0) fatal("sigaction failed"); - if (sigaction(SIGHUP, &sigact, NULL) != 0) - fatal("sigaction failed"); + event_del(&ev_sighup); event_del(&ev_sigchld); event_del(&ev_sigcont); event_del(&ev_sigterm); |