aboutsummaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
Diffstat (limited to 'init')
-rw-r--r--init/init.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/init/init.c b/init/init.c
index 340731b8b..a7bbd5e64 100644
--- a/init/init.c
+++ b/init/init.c
@@ -463,7 +463,11 @@ static void set_sane_term(void)
463#endif 463#endif
464 464
465 /* Make it be sane */ 465 /* Make it be sane */
466 tty.c_cflag &= CBAUD | CBAUDEX | CSIZE | CSTOPB | PARENB | PARODD; 466#ifndef CRTSCTS
467# define CRTSCTS 0
468#endif
469 /* added CRTSCTS to fix Debian bug 528560 */
470 tty.c_cflag &= CBAUD | CBAUDEX | CSIZE | CSTOPB | PARENB | PARODD | CRTSCTS;
467 tty.c_cflag |= CREAD | HUPCL | CLOCAL; 471 tty.c_cflag |= CREAD | HUPCL | CLOCAL;
468 472
469 /* input modes */ 473 /* input modes */
@@ -473,8 +477,7 @@ static void set_sane_term(void)
473 tty.c_oflag = OPOST | ONLCR; 477 tty.c_oflag = OPOST | ONLCR;
474 478
475 /* local modes */ 479 /* local modes */
476 tty.c_lflag = 480 tty.c_lflag = ISIG | ICANON | ECHO | ECHOE | ECHOK | ECHOCTL | ECHOKE | IEXTEN;
477 ISIG | ICANON | ECHO | ECHOE | ECHOK | ECHOCTL | ECHOKE | IEXTEN;
478 481
479 tcsetattr_stdin_TCSANOW(&tty); 482 tcsetattr_stdin_TCSANOW(&tty);
480} 483}
@@ -657,7 +660,9 @@ static struct init_action *mark_terminated(pid_t pid)
657 return a; 660 return a;
658 } 661 }
659 } 662 }
660 update_utmp(pid, DEAD_PROCESS, /*tty_name:*/ NULL, /*username:*/ NULL, /*hostname:*/ NULL); 663 update_utmp(pid, DEAD_PROCESS, /*tty_name:*/ NULL,
664 /*username:*/ NULL,
665 /*hostname:*/ NULL);
661 } 666 }
662 return NULL; 667 return NULL;
663} 668}
@@ -1083,8 +1088,6 @@ static int check_delayed_sigs(void)
1083int init_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 1088int init_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
1084int init_main(int argc UNUSED_PARAM, char **argv) 1089int init_main(int argc UNUSED_PARAM, char **argv)
1085{ 1090{
1086 die_sleep = 30 * 24*60*60; /* if xmalloc would ever die... */
1087
1088 if (argv[1] && strcmp(argv[1], "-q") == 0) { 1091 if (argv[1] && strcmp(argv[1], "-q") == 0) {
1089 return kill(1, SIGHUP); 1092 return kill(1, SIGHUP);
1090 } 1093 }
@@ -1103,6 +1106,15 @@ int init_main(int argc UNUSED_PARAM, char **argv)
1103#endif 1106#endif
1104 } 1107 }
1105 1108
1109 /* If, say, xmalloc would ever die, we don't want to oops kernel
1110 * by exiting.
1111 * NB: we set die_sleep *after* PID 1 check and bb_show_usage.
1112 * Otherwise, for example, "init u" ("please rexec yourself"
1113 * command for sysvinit) will show help text (which isn't too bad),
1114 * *and sleep forever* (which is bad!)
1115 */
1116 die_sleep = 30 * 24*60*60;
1117
1106 /* Figure out where the default console should be */ 1118 /* Figure out where the default console should be */
1107 console_init(); 1119 console_init();
1108 set_sane_term(); 1120 set_sane_term();
@@ -1170,7 +1182,7 @@ int init_main(int argc UNUSED_PARAM, char **argv)
1170 /* SELinux in enforcing mode but load_policy failed */ 1182 /* SELinux in enforcing mode but load_policy failed */
1171 message(L_CONSOLE, "can't load SELinux Policy. " 1183 message(L_CONSOLE, "can't load SELinux Policy. "
1172 "Machine is in enforcing mode. Halting now."); 1184 "Machine is in enforcing mode. Halting now.");
1173 exit(EXIT_FAILURE); 1185 return EXIT_FAILURE;
1174 } 1186 }
1175 } 1187 }
1176#endif 1188#endif