mirror of
https://github.com/troglobit/finit.git
synced 2026-10-02 22:13:01 +07:00
getty.c: Ignore signals like SIGINT, SIGHUP
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
+9
-4
@@ -87,7 +87,8 @@ static void stty(int fd, speed_t speed, int noclear)
|
|||||||
term.c_iflag = ICRNL|IXON|IXOFF;
|
term.c_iflag = ICRNL|IXON|IXOFF;
|
||||||
term.c_oflag = OPOST|ONLCR;
|
term.c_oflag = OPOST|ONLCR;
|
||||||
term.c_cflag |= CS8|CREAD|HUPCL|CBAUDEX;
|
term.c_cflag |= CS8|CREAD|HUPCL|CBAUDEX;
|
||||||
term.c_lflag |= ISIG|ICANON|ECHO|ECHOE|ECHOK|ECHOKE;
|
term.c_lflag |= ICANON|ECHO|ECHOE|ECHOK|ECHOKE;
|
||||||
|
term.c_lflag &= ~ISIG;
|
||||||
|
|
||||||
/* Reset special characters to defaults */
|
/* Reset special characters to defaults */
|
||||||
term.c_cc[VINTR] = CTRL('C');
|
term.c_cc[VINTR] = CTRL('C');
|
||||||
@@ -320,13 +321,17 @@ int getty(char *tty, char *baud, char *term, int noclear, char *user)
|
|||||||
warn("Failed TIOCSCTTY");
|
warn("Failed TIOCSCTTY");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Don't let QUIT dump core.
|
* Ignore a few signals, needed to prevent Ctrl-C at login:
|
||||||
|
* prompt and to prevent QUIT from dumping core.
|
||||||
*/
|
*/
|
||||||
sigemptyset(&sa.sa_mask);
|
sigemptyset(&sa.sa_mask);
|
||||||
sa.sa_flags = 0;
|
sa.sa_flags = SA_RESTART;
|
||||||
sa.sa_handler = _exit;
|
sa.sa_handler = SIG_IGN;
|
||||||
|
sigaction(SIGHUP, &sa, NULL);
|
||||||
|
sigaction(SIGINT, &sa, NULL);
|
||||||
sigaction(SIGQUIT, &sa, NULL);
|
sigaction(SIGQUIT, &sa, NULL);
|
||||||
|
|
||||||
|
/* Set up TTY */
|
||||||
stty(fd, speed, noclear);
|
stty(fd, speed, noclear);
|
||||||
close(fd);
|
close(fd);
|
||||||
utmp_set_login(tty, NULL);
|
utmp_set_login(tty, NULL);
|
||||||
|
|||||||
Reference in New Issue
Block a user