aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--init/init.c36
1 files changed, 31 insertions, 5 deletions
diff --git a/init/init.c b/init/init.c
index 8a63ff350..0c8dc89dc 100644
--- a/init/init.c
+++ b/init/init.c
@@ -865,9 +865,11 @@ static void new_init_action(int action, const char *command, const char *cons)
865 865
866 /* Append to the end of the list */ 866 /* Append to the end of the list */
867 for (a = last = init_action_list; a; a = a->next) { 867 for (a = last = init_action_list; a; a = a->next) {
868 /* don't enter action if it's already in the list */ 868 /* don't enter action if it's already in the list,
869 * but do overwrite existing actions */
869 if ((strcmp(a->command, command) == 0) && 870 if ((strcmp(a->command, command) == 0) &&
870 (strcmp(a->terminal, cons) ==0)) { 871 (strcmp(a->terminal, cons) ==0)) {
872 a->action = action;
871 free(new_action); 873 free(new_action);
872 return; 874 return;
873 } 875 }
@@ -1047,14 +1049,33 @@ static void parse_inittab(void)
1047#endif /* CONFIG_FEATURE_USE_INITTAB */ 1049#endif /* CONFIG_FEATURE_USE_INITTAB */
1048} 1050}
1049 1051
1052#ifdef CONFIG_FEATURE_USE_INITTAB
1050static void reload_signal(int sig) 1053static void reload_signal(int sig)
1051{ 1054{
1052 message(LOG, "Reloading /etc/inittab"); 1055 struct init_action *a, *tmp;
1053 parse_inittab(); 1056
1057 message(LOG, "Reloading /etc/inittab");
1058
1059 /* disable old entrys */
1060 for (a = init_action_list; a; a = a->next ) {
1061 a->action = ONCE;
1062 }
1063
1064 parse_inittab();
1065
1066 /* remove unused entrys */
1067 for (a = init_action_list; a; a = tmp) {
1068 tmp = a->next;
1069 if (a->action & (ONCE | SYSINIT | WAIT ) &&
1070 a->pid == 0 ) {
1071 delete_init_action(a);
1072 }
1073 }
1054 run_actions(RESPAWN); 1074 run_actions(RESPAWN);
1055 return; 1075 return;
1056} 1076}
1057 1077#endif /* CONFIG_FEATURE_USE_INITTAB */
1078
1058extern int init_main(int argc, char **argv) 1079extern int init_main(int argc, char **argv)
1059{ 1080{
1060 struct init_action *a; 1081 struct init_action *a;
@@ -1145,8 +1166,13 @@ extern int init_main(int argc, char **argv)
1145 /* Next run anything to be run only once */ 1166 /* Next run anything to be run only once */
1146 run_actions(ONCE); 1167 run_actions(ONCE);
1147 1168
1169#ifdef CONFIG_FEATURE_USE_INITTAB
1148 /* Redefine SIGHUP to reread /etc/inittab */ 1170 /* Redefine SIGHUP to reread /etc/inittab */
1149 signal(SIGHUP, reload_signal); 1171 signal(SIGHUP, reload_signal);
1172#else
1173 signal(SIGHUP, SIG_IGN);
1174#endif /* CONFIG_FEATURE_USE_INITTAB */
1175
1150 1176
1151 /* Now run the looping stuff for the rest of forever */ 1177 /* Now run the looping stuff for the rest of forever */
1152 while (1) { 1178 while (1) {