From d77bf2fb62183eab3ee87f8ab8ace064a1b0beee Mon Sep 17 00:00:00 2001 From: andersen Date: Fri, 8 Oct 2004 08:17:39 +0000 Subject: 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. git-svn-id: svn://busybox.net/trunk/busybox@9326 69ca8d6d-28ef-0310-b511-8ec308f3f277 --- init/init.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'init') diff --git a/init/init.c b/init/init.c index 2278e521f..8a63ff350 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; } -- cgit v1.2.3-55-g6feb