mirror of
https://github.com/troglobit/finit.git
synced 2026-10-29 12:40:44 +00:00
getty: Ignore SIGINT & C:o earlier
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
ab760aa3ff
commit
796701c854
2 files changed
+12
-12
No files matched your search
+12
@@ -236,6 +236,7 @@ int exec_runtask(char *cmd, char *args[])
|
|||||||
|
|
||||||
static void prepare_tty(char *tty, speed_t speed, char *procname)
|
static void prepare_tty(char *tty, speed_t speed, char *procname)
|
||||||
{
|
{
|
||||||
|
struct sigaction sa;
|
||||||
struct termios term;
|
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 */
|
/* Reset signal handlers that were set by the parent process */
|
||||||
sig_unblock();
|
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();
|
setsid();
|
||||||
|
|
||||||
/* Set INIT_PROCESS UTMP entry */
|
/* Set INIT_PROCESS UTMP entry */
|
||||||
|
|||||||
-12
@@ -212,7 +212,6 @@ int getty(char *tty, speed_t speed, char *term, char *user)
|
|||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
char name[30];
|
char name[30];
|
||||||
struct sigaction sa;
|
|
||||||
|
|
||||||
/* Detach from initial controlling TTY */
|
/* Detach from initial controlling TTY */
|
||||||
vhangup();
|
vhangup();
|
||||||
@@ -228,17 +227,6 @@ int getty(char *tty, speed_t speed, char *term, char *user)
|
|||||||
if (ioctl(STDIN_FILENO, TIOCSCTTY, 1) < 0)
|
if (ioctl(STDIN_FILENO, TIOCSCTTY, 1) < 0)
|
||||||
warn("Failed TIOCSCTTY");
|
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 */
|
/* The getty process is responsible for the UTMP login record */
|
||||||
utmp_set_login(tty, NULL);
|
utmp_set_login(tty, NULL);
|
||||||
if (!user)
|
if (!user)
|
||||||
|
|||||||
Reference in new issue
Block a user