diff options
author | Stef Walter <stef@memberwebs.com> | 2009-08-26 18:29:24 +0000 |
---|---|---|
committer | Stef Walter <stef@memberwebs.com> | 2009-08-26 18:29:24 +0000 |
commit | 55681cd3676523d5d30e3dea06d423ef3e3d4a16 (patch) | |
tree | c5a9a03c5b56285082e31fe901df52cf96bd4983 /srcx/util.c | |
parent | cc6103ced7f737babc472708a31a3e91daa2a020 (diff) |
Revert changes to signal masks before launching child processes.
Diffstat (limited to 'srcx/util.c')
-rw-r--r-- | srcx/util.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/srcx/util.c b/srcx/util.c index 8542b35..6aad984 100644 --- a/srcx/util.c +++ b/srcx/util.c @@ -379,6 +379,7 @@ int run_simple_command(const char* jail, const char* cmd, char* env[], /* This is the child here */ case 0: + unignore_signals (); if(args) execve(cmd, args, env); else @@ -446,6 +447,8 @@ int run_dup_command(const char* jail, const char* cmd, char* env[], /* This is the child here */ case 0: { + unignore_signals (); + /* Fix up our end of the pipe */ if(dup2(outpipe[WRITE_END], STDOUT) < 0 || dup2(outpipe[WRITE_END], STDERR) < 0) @@ -579,3 +582,17 @@ int run_jail_command(const char* jail, const char* cmd, char* args[], int opts) return run_simple_command(jail, cmd, env, args, opts); } +void ignore_signals(void) +{ + signal(SIGHUP, SIG_IGN); + signal(SIGPIPE, SIG_IGN); + signal(SIGTERM, SIG_IGN); +} + +void unignore_signals(void) +{ + signal(SIGHUP, SIG_DFL); + signal(SIGPIPE, SIG_DFL); + signal(SIGTERM, SIG_DFL); +} + |