mirror of
https://github.com/troglobit/finit.git
synced 2026-10-02 05:52:48 +07:00
Follow-up to cf60cdd, make sure to disable ISIG before calling getty
Disable INTR, QUIT, SUSP, and DSUSP while handing over to getty. It is
up to the getty process to allow ISIG again.
This patch is due to the differences in control line setup between ARM,
x86/x86_64, and most notably PPC. PPC in particular seem to have ISIG
set by default from the kernel.
Without this patch pressing Ctrl-C before getty is started will lead to
Finit receiving SIGINT and defaulting to a reboot, as introduced in the
BusyBox init signal adoption in eeb59eb.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
+13
@@ -30,6 +30,7 @@
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/prctl.h>
|
||||
#include <sys/wait.h>
|
||||
#include <termios.h>
|
||||
#include <lite/lite.h>
|
||||
|
||||
#include "finit.h"
|
||||
@@ -236,6 +237,18 @@ int exec_runtask(char *cmd, char *args[])
|
||||
|
||||
static void prepare_tty(char *tty, char *procname, int console)
|
||||
{
|
||||
struct termios term;
|
||||
|
||||
/*
|
||||
* Disable INTR, QUIT, SUSP, and DSUSP while handing over to
|
||||
* getty. It is up to the getty process to allow ISIG again.
|
||||
*/
|
||||
tcdrain(STDIN_FILENO);
|
||||
if (!tcgetattr(STDIN_FILENO, &term)) {
|
||||
term.c_lflag &= ~ISIG;
|
||||
tcsetattr(STDIN_FILENO, TCSANOW, &term);
|
||||
}
|
||||
|
||||
/* Reset signal handlers that were set by the parent process */
|
||||
sig_unblock();
|
||||
setsid();
|
||||
|
||||
Reference in New Issue
Block a user