summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen2004-10-08 08:17:39 +0000
committerEric Andersen2004-10-08 08:17:39 +0000
commit2271809d75a2df26a5afbdab1aaf0ec3623d2ce0 (patch)
tree1eb90c4f50fe77b96351bf4d1fc9fb0e3a79df3a
parentc00e11df856d280d7cff64aed78385e5f8be26bd (diff)
downloadbusybox-2271809d75a2df26a5afbdab1aaf0ec3623d2ce0.zip
busybox-2271809d75a2df26a5afbdab1aaf0ec3623d2ce0.tar.gz
Hiroshi Ito writes:
"kill -HUP 1" reloads inittab, and when I append one line to inittab and send HUP signal two times, It will starts 2 process. patch against current CVS is attached.
-rw-r--r--init/init.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/init/init.c b/init/init.c
index 2278e52..8a63ff3 100644
--- a/init/init.c
+++ b/init/init.c
@@ -846,7 +846,7 @@ static void cont_handler(int sig)
static void new_init_action(int action, const char *command, const char *cons)
{
- struct init_action *new_action, *a;
+ struct init_action *new_action, *a, *last;
if (*cons == '\0')
cons = console;
@@ -864,16 +864,17 @@ static void new_init_action(int action, const char *command, const char *cons)
}
/* Append to the end of the list */
- for (a = init_action_list; a && a->next; a = a->next) {
+ for (a = last = init_action_list; a; a = a->next) {
/* don't enter action if it's already in the list */
if ((strcmp(a->command, command) == 0) &&
(strcmp(a->terminal, cons) ==0)) {
free(new_action);
return;
}
+ last = a;
}
- if (a) {
- a->next = new_action;
+ if (last) {
+ last->next = new_action;
} else {
init_action_list = new_action;
}