aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2020-10-08 19:27:19 +0200
committerPřemysl Eric Janouch <p@janouch.name>2020-10-08 19:49:07 +0200
commit6aa4bd2ff5e70b2067baaed720c9e64b63f62767 (patch)
tree42e66f480649675fd878f25b627c7df5e5522963
parent000315165df66f23519fd3b503197c9818562d90 (diff)
downloadsdn-6aa4bd2ff5e70b2067baaed720c9e64b63f62767.tar.gz
sdn-6aa4bd2ff5e70b2067baaed720c9e64b63f62767.tar.xz
sdn-6aa4bd2ff5e70b2067baaed720c9e64b63f62767.zip
When resuming a child, resume the whole group
SIGTSTP is sent to the entire foreground process group, so do the some with our SIGCONT. Debian's default sh (dash) doesn't replace itself with the command, even if it's the last one in the -c option. Of course, we do not need to use /bin/sh for the helpers at all, though it doesn't cost us much. We could also issue an explicit `exec`.
-rw-r--r--sdn.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/sdn.cpp b/sdn.cpp
index 83fbbd1..fdbb1f7 100644
--- a/sdn.cpp
+++ b/sdn.cpp
@@ -888,7 +888,7 @@ fun run_program (initializer_list<const char*> list, const string &filename) {
// We don't provide job control--don't let us hang after ^Z
while (waitpid (child, &status, WUNTRACED) > -1 && WIFSTOPPED (status))
if (WSTOPSIG (status) == SIGTSTP)
- kill (child, SIGCONT);
+ kill (-child, SIGCONT);
tcsetpgrp (STDOUT_FILENO, getpgid (0));
if (WIFEXITED (status) && WEXITSTATUS (status)) {