diff --git a/apps/getty.c b/apps/getty.c index 10a246198..da87d959d 100644 --- a/apps/getty.c +++ b/apps/getty.c @@ -56,6 +56,8 @@ int main(int argc, char * argv[]) { dup2(fd_serial, 0); dup2(fd_serial, 1); dup2(fd_serial, 2); + ioctl(STDIN_FILENO, TIOCSCTTY, &(int){1}); + tcsetpgrp(STDIN_FILENO, getpid()); system("stty sane"); diff --git a/apps/login.c b/apps/login.c index 3c4a122ed..c0cf20a84 100644 --- a/apps/login.c +++ b/apps/login.c @@ -144,8 +144,10 @@ int main(int argc, char ** argv) { f = fork(); if (getpid() != pid) { ioctl(STDIN_FILENO, IOCTLTTYLOGIN, &uid); - toaru_set_credentials(uid); setsid(); + ioctl(STDIN_FILENO, TIOCSCTTY, &(int){1}); + tcsetpgrp(STDIN_FILENO, getpid()); + toaru_set_credentials(uid); char * args[] = { getenv("SHELL"), NULL diff --git a/apps/netty.c b/apps/netty.c index 68a75258c..d01d7624b 100644 --- a/apps/netty.c +++ b/apps/netty.c @@ -112,6 +112,8 @@ int main(int argc, char * argv[]) { dup2(fd_slave, 0); dup2(fd_slave, 1); dup2(fd_slave, 2); + ioctl(STDIN_FILENO, TIOCSCTTY, &(int){1}); + tcsetpgrp(STDIN_FILENO, getpid()); system("ttysize -q"); diff --git a/apps/terminal-vga.c b/apps/terminal-vga.c index 688e1868a..7d5ab61f1 100644 --- a/apps/terminal-vga.c +++ b/apps/terminal-vga.c @@ -1298,6 +1298,8 @@ int main(int argc, char ** argv) { dup2(fd_slave, 0); dup2(fd_slave, 1); dup2(fd_slave, 2); + ioctl(STDIN_FILENO, TIOCSCTTY, &(int){1}); + tcsetpgrp(STDIN_FILENO, getpid()); if (argv[optind] != NULL) { char * tokens[] = {argv[optind], NULL}; diff --git a/apps/terminal.c b/apps/terminal.c index e856fe7e5..156b7b651 100644 --- a/apps/terminal.c +++ b/apps/terminal.c @@ -2689,6 +2689,7 @@ int main(int argc, char ** argv) { dup2(fd_slave, 1); dup2(fd_slave, 2); + ioctl(STDIN_FILENO, TIOCSCTTY, &(int){1}); tcsetpgrp(STDIN_FILENO, getpid()); /* Set the TERM environment variable. */