diff options
author | Thomas Adam <thomas@xteddy.org> | 2017-07-12 13:39:59 +0100 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2017-07-12 13:43:08 +0100 |
commit | 1076a2e26c224d17c32a2d1770997d8718903f20 (patch) | |
tree | 2a51f6e719b9cbff0e37d7a887e56992ffb875bd /cmd-pipe-pane.c | |
parent | fbbf5a108b01c742ca11e779845a4d19a1c5edd1 (diff) | |
parent | 51112221eeb31ced907f0dfcf077582996c20c07 (diff) | |
download | rtmux-1076a2e26c224d17c32a2d1770997d8718903f20.tar.gz rtmux-1076a2e26c224d17c32a2d1770997d8718903f20.tar.bz2 rtmux-1076a2e26c224d17c32a2d1770997d8718903f20.zip |
Merge branch 'obsd-master'
Conflicts:
cmd-pipe-pane.c
proc.c
tmux.c
window.c
Diffstat (limited to 'cmd-pipe-pane.c')
-rw-r--r-- | cmd-pipe-pane.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/cmd-pipe-pane.c b/cmd-pipe-pane.c index ba89ab00..5df2d11f 100644 --- a/cmd-pipe-pane.c +++ b/cmd-pipe-pane.c @@ -21,6 +21,7 @@ #include <errno.h> #include <fcntl.h> +#include <signal.h> #include <stdlib.h> #include <string.h> #include <time.h> @@ -61,6 +62,7 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmdq_item *item) char *cmd; int old_fd, pipe_fd[2], null_fd; struct format_tree *ft; + sigset_t set, oldset; /* Destroy the old pipe. */ old_fd = wp->pipe_fd; @@ -101,16 +103,20 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmdq_item *item) format_free(ft); /* Fork the child. */ + sigfillset(&set); + sigprocmask(SIG_BLOCK, &set, &oldset); switch (fork()) { case -1: + sigprocmask(SIG_SETMASK, &oldset, NULL); cmdq_error(item, "fork error: %s", strerror(errno)); free(cmd); return (CMD_RETURN_ERROR); case 0: /* Child process. */ + proc_clear_signals(server_proc); + sigprocmask(SIG_SETMASK, &oldset, NULL); close(pipe_fd[0]); - clear_signals(1); if (dup2(pipe_fd[1], STDIN_FILENO) == -1) _exit(1); @@ -131,6 +137,7 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmdq_item *item) _exit(1); default: /* Parent process. */ + sigprocmask(SIG_SETMASK, &oldset, NULL); close(pipe_fd[1]); wp->pipe_fd = pipe_fd[0]; |