aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2000-09-13 16:15:29 +0000
committerEric Andersen <andersen@codepoet.org>2000-09-13 16:15:29 +0000
commitfb6a50820cb973becc2f590aaf3979c183e33e0e (patch)
treeae11604a3e2f715ca56720a1b3593f54f9259ed3
parentd39d12099805ff4e0bb8841e951fc758d9b517c7 (diff)
downloadbusybox-fb6a50820cb973becc2f590aaf3979c183e33e0e.tar.gz
Ensure forked processes always are on a controlling tty, so the
^C can be properly sent to /dev/console. -Erik
-rw-r--r--init.c3
-rw-r--r--init/init.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/init.c b/init.c
index b532ea88f..b3ae97d2e 100644
--- 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);
diff --git a/init/init.c b/init/init.c
index b532ea88f..b3ae97d2e 100644
--- a/init/init.c
+++ b/init/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);