Ensure forked processes always are on a controlling tty, so the
authorEric Andersen <andersen@codepoet.org>
Wed, 13 Sep 2000 16:15:29 +0000 (16:15 -0000)
committerEric Andersen <andersen@codepoet.org>
Wed, 13 Sep 2000 16:15:29 +0000 (16:15 -0000)
^C can be properly sent to /dev/console.
 -Erik

init.c
init/init.c

diff --git a/init.c b/init.c
index b532ea88ff7edcffe0174d17d565ad53c7b07643..b3ae97d2e15af109c53137df828eccff1a6e1f1b 100644 (file)
--- a/init.c
+++ b/init.c
@@ -411,6 +411,7 @@ static pid_t run(char *command, char *terminal, int get_enter)
 
        if ((pid = fork()) == 0) {
                /* Clean up */
+               ioctl(0, TIOCNOTTY, 0);
                close(0);
                close(1);
                close(2);
@@ -430,7 +431,7 @@ static pid_t run(char *command, char *terminal, int get_enter)
                dup2(fd, 0);
                dup2(fd, 1);
                dup2(fd, 2);
-               ioctl(0, TIOCSCTTY, 0);
+               ioctl(0, TIOCSCTTY, 1);
                tcsetpgrp(0, getpgrp());
                set_term(0);
 
index b532ea88ff7edcffe0174d17d565ad53c7b07643..b3ae97d2e15af109c53137df828eccff1a6e1f1b 100644 (file)
@@ -411,6 +411,7 @@ static pid_t run(char *command, char *terminal, int get_enter)
 
        if ((pid = fork()) == 0) {
                /* Clean up */
+               ioctl(0, TIOCNOTTY, 0);
                close(0);
                close(1);
                close(2);
@@ -430,7 +431,7 @@ static pid_t run(char *command, char *terminal, int get_enter)
                dup2(fd, 0);
                dup2(fd, 1);
                dup2(fd, 2);
-               ioctl(0, TIOCSCTTY, 0);
+               ioctl(0, TIOCSCTTY, 1);
                tcsetpgrp(0, getpgrp());
                set_term(0);