mirror of
https://github.com/troglobit/finit.git
synced 2026-10-02 05:52:48 +07:00
getty: Ignore SIGINT & C:o earlier
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
+12
@@ -236,6 +236,7 @@ int exec_runtask(char *cmd, char *args[])
|
||||
|
||||
static void prepare_tty(char *tty, speed_t speed, char *procname)
|
||||
{
|
||||
struct sigaction sa;
|
||||
struct termios term;
|
||||
|
||||
/*
|
||||
@@ -257,6 +258,17 @@ static void prepare_tty(char *tty, speed_t speed, char *procname)
|
||||
|
||||
/* Reset signal handlers that were set by the parent process */
|
||||
sig_unblock();
|
||||
|
||||
/*
|
||||
* Ignore a few signals, needed to prevent Ctrl-C at login:
|
||||
* prompt and to prevent QUIT from dumping core.
|
||||
*/
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sa.sa_flags = SA_RESTART;
|
||||
sa.sa_handler = SIG_IGN;
|
||||
sigaction(SIGHUP, &sa, NULL);
|
||||
sigaction(SIGINT, &sa, NULL);
|
||||
sigaction(SIGQUIT, &sa, NULL);
|
||||
setsid();
|
||||
|
||||
/* Set INIT_PROCESS UTMP entry */
|
||||
|
||||
-12
@@ -212,7 +212,6 @@ int getty(char *tty, speed_t speed, char *term, char *user)
|
||||
{
|
||||
int fd;
|
||||
char name[30];
|
||||
struct sigaction sa;
|
||||
|
||||
/* Detach from initial controlling TTY */
|
||||
vhangup();
|
||||
@@ -228,17 +227,6 @@ int getty(char *tty, speed_t speed, char *term, char *user)
|
||||
if (ioctl(STDIN_FILENO, TIOCSCTTY, 1) < 0)
|
||||
warn("Failed TIOCSCTTY");
|
||||
|
||||
/*
|
||||
* Ignore a few signals, needed to prevent Ctrl-C at login:
|
||||
* prompt and to prevent QUIT from dumping core.
|
||||
*/
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sa.sa_flags = SA_RESTART;
|
||||
sa.sa_handler = SIG_IGN;
|
||||
sigaction(SIGHUP, &sa, NULL);
|
||||
sigaction(SIGINT, &sa, NULL);
|
||||
sigaction(SIGQUIT, &sa, NULL);
|
||||
|
||||
/* The getty process is responsible for the UTMP login record */
|
||||
utmp_set_login(tty, NULL);
|
||||
if (!user)
|
||||
|
||||
Reference in New Issue
Block a user