From 55681cd3676523d5d30e3dea06d423ef3e3d4a16 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Wed, 26 Aug 2009 18:29:24 +0000 Subject: Revert changes to signal masks before launching child processes. --- srcx/util.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'srcx/util.c') 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); +} + -- cgit v1.2.3