summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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);
}