summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-04-18 16:54:32 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-04-18 16:54:32 +0200
commitd4c410f99a3e95478727a50e9d78d1b66cb57c19 (patch)
treee24975eb5aebb506efbe985de8d70da3dabf5b4a
parente6ad38a5409b18b573a59177ea8bb21c22747964 (diff)
downloadfastd-d4c410f99a3e95478727a50e9d78d1b66cb57c19.tar
fastd-d4c410f99a3e95478727a50e9d78d1b66cb57c19.zip
shell: unblock SIGCHLD before exec
-rw-r--r--src/shell.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/shell.c b/src/shell.c
index 8690a1f..23381e0 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -141,11 +141,18 @@ static bool shell_command_do_exec(fastd_context_t *ctx, const fastd_shell_comman
}
/* child process */
+
if (chdir(command->dir))
_exit(126);
shell_command_setenv(ctx, parent, peer, local_addr, peer_addr);
+ /* unblock SIGCHLD */
+ sigset_t set;
+ sigemptyset(&set);
+ sigaddset(&set, SIGCHLD);
+ pthread_sigmask(SIG_UNBLOCK, &set, NULL);
+
execl("/bin/sh", "sh", "-c", command->command, (char*)NULL);
_exit(127);
}