diff --git a/ltx.c b/ltx.c index 68a93c9..0d46c46 100644 --- a/ltx.c +++ b/ltx.c @@ -735,11 +735,14 @@ static void ltx_handle_exec(struct ltx_session *session) /* setup parent */ if (pid) { + setpgid(pid, pid); close(pipefd[1]); exec_slot->pid = pid; return; } + setpgid(0, 0); + /* redirect stdout to pipe */ if (dup2(pipefd[1], STDOUT_FILENO) == -1) { LTX_HANDLE_ERROR(session, "dup2() stdout", 1); @@ -915,7 +918,7 @@ static void ltx_handle_kill(struct ltx_session *session) if (exec_slot->pid == -1) return; - int ret = kill(exec_slot->pid, SIGKILL); + int ret = kill(-exec_slot->pid, SIGKILL); if (ret == -1 && errno != ESRCH) { LTX_HANDLE_ERROR(session, "kill() error", 1); return;