summaryrefslogtreecommitdiff
path: root/srcx/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'srcx/util.c')
-rw-r--r--srcx/util.c17
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);
+}
+