aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2004-10-08 08:21:54 +0000
committerEric Andersen <andersen@codepoet.org>2004-10-08 08:21:54 +0000
commit82baf63de5eb905ab255b4eea31e283f89f4cbf4 (patch)
tree0272388e146d81fa001889397f66930a070d96b4
parent2271809d75a2df26a5afbdab1aaf0ec3623d2ce0 (diff)
downloadbusybox-82baf63de5eb905ab255b4eea31e283f89f4cbf4.tar.gz
Hiroshi Ito writes:
Hello, all. Busybox init does not handle removed inittab entry correctly. # I'm sorry about my poor english, but you can find # what I would like to say from patch, isn't it? even if you apply this path, when yoy try to change a command line option in inittab, you have to do following steps. 1. remove old line from initrd 2. send HUP signal to init 3. kill old proces which is invoked from init. 4. append new line to inittab 5. send HUP signal to init, again patch is against current CVS + last patch witch I send it last.
-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)
/* Append to the end of the list */
for (a = last = init_action_list; a; a = a->next) {
- /* don't enter action if it's already in the list */
+ /* don't enter action if it's already in the list,
+ * but do overwrite existing actions */
if ((strcmp(a->command, command) == 0) &&
(strcmp(a->terminal, cons) ==0)) {
+ a->action = action;
free(new_action);
return;
}
@@ -1047,14 +1049,33 @@ static void parse_inittab(void)
#endif /* CONFIG_FEATURE_USE_INITTAB */
}
+#ifdef CONFIG_FEATURE_USE_INITTAB
static void reload_signal(int sig)
{
- message(LOG, "Reloading /etc/inittab");
- parse_inittab();
+ struct init_action *a, *tmp;
+
+ message(LOG, "Reloading /etc/inittab");
+
+ /* disable old entrys */
+ for (a = init_action_list; a; a = a->next ) {
+ a->action = ONCE;
+ }
+
+ parse_inittab();
+
+ /* remove unused entrys */
+ for (a = init_action_list; a; a = tmp) {
+ tmp = a->next;
+ if (a->action & (ONCE | SYSINIT | WAIT ) &&
+ a->pid == 0 ) {
+ delete_init_action(a);
+ }
+ }
run_actions(RESPAWN);
- return;
+ return;
}
-
+#endif /* CONFIG_FEATURE_USE_INITTAB */
+
extern int init_main(int argc, char **argv)
{
struct init_action *a;
@@ -1145,8 +1166,13 @@ extern int init_main(int argc, char **argv)
/* Next run anything to be run only once */
run_actions(ONCE);
+#ifdef CONFIG_FEATURE_USE_INITTAB
/* Redefine SIGHUP to reread /etc/inittab */
signal(SIGHUP, reload_signal);
+#else
+ signal(SIGHUP, SIG_IGN);
+#endif /* CONFIG_FEATURE_USE_INITTAB */
+
/* Now run the looping stuff for the rest of forever */
while (1) {