summaryrefslogtreecommitdiffstats
path: root/job.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2017-07-12 13:39:59 +0100
committerThomas Adam <thomas@xteddy.org>2017-07-12 13:43:08 +0100
commit1076a2e26c224d17c32a2d1770997d8718903f20 (patch)
tree2a51f6e719b9cbff0e37d7a887e56992ffb875bd /job.c
parentfbbf5a108b01c742ca11e779845a4d19a1c5edd1 (diff)
parent51112221eeb31ced907f0dfcf077582996c20c07 (diff)
Merge branch 'obsd-master'
Conflicts: cmd-pipe-pane.c proc.c tmux.c window.c
Diffstat (limited to 'job.c')
-rw-r--r--job.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/job.c b/job.c
index 01b270c2..dfe3d691 100644
--- a/job.c
+++ b/job.c
@@ -50,6 +50,7 @@ job_run(const char *cmd, struct session *s, const char *cwd,
pid_t pid;
int nullfd, out[2];
const char *home;
+ sigset_t set, oldset;
if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, out) != 0)
return (NULL);
@@ -60,14 +61,18 @@ job_run(const char *cmd, struct session *s, const char *cwd,
*/
env = environ_for_session(s, !cfg_finished);
+ sigfillset(&set);
+ sigprocmask(SIG_BLOCK, &set, &oldset);
switch (pid = fork()) {
case -1:
+ sigprocmask(SIG_SETMASK, &oldset, NULL);
environ_free(env);
close(out[0]);
close(out[1]);
return (NULL);
- case 0: /* child */
- clear_signals(1);
+ case 0:
+ proc_clear_signals(server_proc);
+ sigprocmask(SIG_SETMASK, &oldset, NULL);
if (cwd == NULL || chdir(cwd) != 0) {
if ((home = find_home()) == NULL || chdir(home) != 0)
@@ -99,7 +104,7 @@ job_run(const char *cmd, struct session *s, const char *cwd,
fatal("execl failed");
}
- /* parent */
+ sigprocmask(SIG_SETMASK, &oldset, NULL);
environ_free(env);
close(out[1]);