diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-10-25 00:40:32 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-10-25 00:40:32 +0200 |
commit | 3b060528a26830ee26aab4e9829ac3a310f06218 (patch) | |
tree | 45d56a63d960fdd4dddea167812b6c2f11d679f9 | |
parent | 03a5fe378e50cb7a43c4c367c6c0e18e6f156597 (diff) | |
download | busybox-w32-3b060528a26830ee26aab4e9829ac3a310f06218.tar.gz busybox-w32-3b060528a26830ee26aab4e9829ac3a310f06218.tar.bz2 busybox-w32-3b060528a26830ee26aab4e9829ac3a310f06218.zip |
init: do not sleep forever on usage errors
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | init/init.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/init/init.c b/init/init.c index 12348078d..a7bbd5e64 100644 --- a/init/init.c +++ b/init/init.c | |||
@@ -660,7 +660,9 @@ static struct init_action *mark_terminated(pid_t pid) | |||
660 | return a; | 660 | return a; |
661 | } | 661 | } |
662 | } | 662 | } |
663 | 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); | ||
664 | } | 666 | } |
665 | return NULL; | 667 | return NULL; |
666 | } | 668 | } |
@@ -1086,8 +1088,6 @@ static int check_delayed_sigs(void) | |||
1086 | int init_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 1088 | int init_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
1087 | int init_main(int argc UNUSED_PARAM, char **argv) | 1089 | int init_main(int argc UNUSED_PARAM, char **argv) |
1088 | { | 1090 | { |
1089 | die_sleep = 30 * 24*60*60; /* if xmalloc would ever die... */ | ||
1090 | |||
1091 | if (argv[1] && strcmp(argv[1], "-q") == 0) { | 1091 | if (argv[1] && strcmp(argv[1], "-q") == 0) { |
1092 | return kill(1, SIGHUP); | 1092 | return kill(1, SIGHUP); |
1093 | } | 1093 | } |
@@ -1106,6 +1106,15 @@ int init_main(int argc UNUSED_PARAM, char **argv) | |||
1106 | #endif | 1106 | #endif |
1107 | } | 1107 | } |
1108 | 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 | |||
1109 | /* Figure out where the default console should be */ | 1118 | /* Figure out where the default console should be */ |
1110 | console_init(); | 1119 | console_init(); |
1111 | set_sane_term(); | 1120 | set_sane_term(); |
@@ -1173,7 +1182,7 @@ int init_main(int argc UNUSED_PARAM, char **argv) | |||
1173 | /* SELinux in enforcing mode but load_policy failed */ | 1182 | /* SELinux in enforcing mode but load_policy failed */ |
1174 | message(L_CONSOLE, "can't load SELinux Policy. " | 1183 | message(L_CONSOLE, "can't load SELinux Policy. " |
1175 | "Machine is in enforcing mode. Halting now."); | 1184 | "Machine is in enforcing mode. Halting now."); |
1176 | exit(EXIT_FAILURE); | 1185 | return EXIT_FAILURE; |
1177 | } | 1186 | } |
1178 | } | 1187 | } |
1179 | #endif | 1188 | #endif |