summary refs log tree commit diff
path: root/command.c
diff options
context:
space:
mode:
authorKlemens Nanni <klemens@posteo.de>2021-06-13 02:28:15 +0000
committerJune McEnroe <june@causal.agency>2021-06-13 16:46:34 -0400
commit9c7ceb23bb9ffaa40af2c7bb50130bb66c607593 (patch)
treec7662e2c0bd05bdbcd79d9f6cd1b02143a008222 /command.c
parentExit on data directory creation error (diff)
downloadcatgirl-9c7ceb23bb9ffaa40af2c7bb50130bb66c607593.tar.gz
catgirl-9c7ceb23bb9ffaa40af2c7bb50130bb66c607593.zip
/exec without controlling terminal
Otherwise "/exec sh </dev/tty" takes over and catgirl must effectively
be killed to stop the madness;  with this diff:

	catgirl  input| /exec sh </dev/tty
	catgirl output| /bin/sh: cannot open /dev/tty: Device not configured
	catgirl output| Process exits with status 1

Do the same for `-C/Copy', `-N/notify' and `-O/open' alike.
Diffstat (limited to 'command.c')
-rw-r--r--command.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/command.c b/command.c
index 4c290fc..b345e11 100644
--- a/command.c
+++ b/command.c
@@ -472,6 +472,7 @@ static void commandExec(uint id, char *params) {
 	if (pid < 0) err(EX_OSERR, "fork");
 	if (pid) return;
 
+	setsid();
 	close(STDIN_FILENO);
 	dup2(execPipe[1], STDOUT_FILENO);
 	dup2(utilPipe[1], STDERR_FILENO);