/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.
weechat-hashes
Klemens Nanni 2021-06-13 02:28:15 +00:00 committed by C. McEnroe
parent 4c0cdae4e5
commit 9c7ceb23bb
3 changed files with 4 additions and 0 deletions

View File

@ -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);

1
ui.c
View File

@ -567,6 +567,7 @@ static void notify(uint id, const char *str) {
if (pid < 0) err(EX_OSERR, "fork");
if (pid) return;
setsid();
close(STDIN_FILENO);
dup2(utilPipe[1], STDOUT_FILENO);
dup2(utilPipe[1], STDERR_FILENO);

2
url.c
View File

@ -123,6 +123,7 @@ static void urlOpen(const char *url) {
if (pid < 0) err(EX_OSERR, "fork");
if (pid) return;
setsid();
close(STDIN_FILENO);
dup2(utilPipe[1], STDOUT_FILENO);
dup2(utilPipe[1], STDERR_FILENO);
@ -174,6 +175,7 @@ static void urlCopy(const char *url) {
return;
}
setsid();
dup2(rw[0], STDIN_FILENO);
dup2(utilPipe[1], STDOUT_FILENO);
dup2(utilPipe[1], STDERR_FILENO);