diff options
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/tmux/cmd-pipe-pane.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/job.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/server.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/signal.c | 31 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.c | 6 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.h | 6 | ||||
-rw-r--r-- | usr.bin/tmux/window.c | 4 |
7 files changed, 37 insertions, 22 deletions
diff --git a/usr.bin/tmux/cmd-pipe-pane.c b/usr.bin/tmux/cmd-pipe-pane.c index 586620a5392..85dda3d6b8d 100644 --- a/usr.bin/tmux/cmd-pipe-pane.c +++ b/usr.bin/tmux/cmd-pipe-pane.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-pipe-pane.c,v 1.14 2010/06/14 23:06:13 nicm Exp $ */ +/* $OpenBSD: cmd-pipe-pane.c,v 1.15 2010/08/19 18:29:01 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -97,7 +97,7 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmd_ctx *ctx) case 0: /* Child process. */ close(pipe_fd[0]); - clear_signals(); + clear_signals(1); if (dup2(pipe_fd[1], STDIN_FILENO) == -1) _exit(1); diff --git a/usr.bin/tmux/job.c b/usr.bin/tmux/job.c index d076453eddb..e540e41d367 100644 --- a/usr.bin/tmux/job.c +++ b/usr.bin/tmux/job.c @@ -1,4 +1,4 @@ -/* $OpenBSD: job.c,v 1.19 2010/05/04 17:28:16 nicm Exp $ */ +/* $OpenBSD: job.c,v 1.20 2010/08/19 18:29:01 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -149,7 +149,7 @@ job_run(struct job *job) case -1: return (-1); case 0: /* child */ - clear_signals(); + clear_signals(1); environ_push(&global_environ); diff --git a/usr.bin/tmux/server.c b/usr.bin/tmux/server.c index daca2387335..a8899394035 100644 --- a/usr.bin/tmux/server.c +++ b/usr.bin/tmux/server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server.c,v 1.91 2010/08/04 19:46:13 deraadt Exp $ */ +/* $OpenBSD: server.c,v 1.92 2010/08/19 18:29:01 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -141,7 +141,7 @@ server_start(char *path) /* event_init() was called in our parent, need to reinit. */ if (event_reinit(ev_base) != 0) fatal("event_reinit failed"); - clear_signals(); + clear_signals(0); logfile("server"); log_debug("server started, pid %ld", (long) getpid()); diff --git a/usr.bin/tmux/signal.c b/usr.bin/tmux/signal.c index 8b4535a929a..892bf7afd34 100644 --- a/usr.bin/tmux/signal.c +++ b/usr.bin/tmux/signal.c @@ -1,4 +1,4 @@ -/* $OpenBSD: signal.c,v 1.5 2010/05/14 14:41:06 nicm Exp $ */ +/* $OpenBSD: signal.c,v 1.6 2010/08/19 18:29:01 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -62,7 +62,7 @@ set_signals(void(*handler)(int, short, unused void *)) } void -clear_signals(void) +clear_signals(int after_fork) { struct sigaction sigact; @@ -79,10 +79,25 @@ clear_signals(void) if (sigaction(SIGTSTP, &sigact, NULL) != 0) fatal("sigaction failed"); - event_del(&ev_sighup); - event_del(&ev_sigchld); - event_del(&ev_sigcont); - event_del(&ev_sigterm); - event_del(&ev_sigusr1); - event_del(&ev_sigwinch); + if (after_fork) { + if (sigaction(SIGHUP, &sigact, NULL) != 0) + fatal("sigaction failed"); + if (sigaction(SIGCHLD, &sigact, NULL) != 0) + fatal("sigaction failed"); + if (sigaction(SIGCONT, &sigact, NULL) != 0) + fatal("sigaction failed"); + if (sigaction(SIGTERM, &sigact, NULL) != 0) + fatal("sigaction failed"); + if (sigaction(SIGUSR1, &sigact, NULL) != 0) + fatal("sigaction failed"); + if (sigaction(SIGWINCH, &sigact, NULL) != 0) + fatal("sigaction failed"); + } else { + event_del(&ev_sighup); + event_del(&ev_sigchld); + event_del(&ev_sigcont); + event_del(&ev_sigterm); + event_del(&ev_sigusr1); + event_del(&ev_sigwinch); + } } diff --git a/usr.bin/tmux/tmux.c b/usr.bin/tmux/tmux.c index 76107b377ef..3493b2bd35c 100644 --- a/usr.bin/tmux/tmux.c +++ b/usr.bin/tmux/tmux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.c,v 1.86 2010/08/04 19:46:13 deraadt Exp $ */ +/* $OpenBSD: tmux.c,v 1.87 2010/08/19 18:29:01 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -549,7 +549,7 @@ main(int argc, char **argv) event_dispatch(); - clear_signals(); + clear_signals(0); client_main(); /* doesn't return */ } @@ -636,7 +636,7 @@ main_dispatch(const char *shellcmd) memcpy(&shelldata, imsg.data, sizeof shelldata); shelldata.shell[(sizeof shelldata.shell) - 1] = '\0'; - clear_signals(); + clear_signals(0); shell_exec(shelldata.shell, shellcmd); default: diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index 52340be36b1..fdabe27e22d 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.237 2010/08/11 07:34:43 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.238 2010/08/19 18:29:01 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -1952,8 +1952,8 @@ void queue_window_name(struct window *); char *default_window_name(struct window *); /* signal.c */ -void set_signals(void(*handler)(int, short, unused void *)); -void clear_signals(void); +void set_signals(void(*)(int, short, void *)); +void clear_signals(int); /* session.c */ extern struct sessions sessions; diff --git a/usr.bin/tmux/window.c b/usr.bin/tmux/window.c index cfb0c200902..d6246380c5c 100644 --- a/usr.bin/tmux/window.c +++ b/usr.bin/tmux/window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window.c,v 1.53 2010/07/14 18:37:49 nicm Exp $ */ +/* $OpenBSD: window.c,v 1.54 2010/08/19 18:29:01 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -574,7 +574,7 @@ window_pane_spawn(struct window_pane *wp, const char *cmd, const char *shell, environ_push(env); - clear_signals(); + clear_signals(1); log_close(); if (*wp->cmd != '\0') { |