From ae0d53310c4172be93a7b104fa59a1b670e46c91 Mon Sep 17 00:00:00 2001 From: project-repo Date: Sun, 24 Dec 2023 11:42:10 +0100 Subject: [PATCH] Reset signal handling when forking --- keybinding.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/keybinding.c b/keybinding.c index 419cf46..e0220c5 100644 --- a/keybinding.c +++ b/keybinding.c @@ -628,7 +628,7 @@ keybinding_split_horizontal(struct cg_server *server) { static void into_process(const char *command) { - execl("/bin/sh", "sh", "-c", command, (char *)NULL); + execlp("sh", "sh", "-c", command, (char *)NULL); _exit(1); } @@ -1656,6 +1656,10 @@ run_action(enum keybinding_action action, struct cg_server *server, case KEYBINDING_RUN_COMMAND: { int pid; if((pid = fork()) == 0) { + setsid(); + sigset_t set; + sigemptyset(&set); + sigprocmask(SIG_SETMASK, &set, NULL); if(fork() == 0) { into_process(data.c); }