summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/signal.c
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2010-05-12 15:05:39 +0000
committerjsing <jsing@openbsd.org>2010-05-12 15:05:39 +0000
commit2bebd0ecd967af4ec062a350a4f3ee4974f4bdb4 (patch)
treea7baf1b1c43edd5a2a1f458a2a4926fccd2149c6 /usr.bin/tmux/signal.c
parentport -ftrampolines/-Wtrampolines support from gcc3. (diff)
downloadwireguard-openbsd-2bebd0ecd967af4ec062a350a4f3ee4974f4bdb4.tar.xz
wireguard-openbsd-2bebd0ecd967af4ec062a350a4f3ee4974f4bdb4.zip
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 'usr.bin/tmux/signal.c')
-rw-r--r--usr.bin/tmux/signal.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/tmux/signal.c b/usr.bin/tmux/signal.c
index 7d9352bdc1d..3405a9a9c3b 100644
--- a/usr.bin/tmux/signal.c
+++ b/usr.bin/tmux/signal.c
@@ -1,4 +1,4 @@
-/* $Id: signal.c,v 1.3 2010/05/04 17:28:16 nicm Exp $ */
+/* $Id: signal.c,v 1.4 2010/05/12 15:05:39 jsing 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);