init: fix bug 1584: improper check for fork error
authorvda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>
Sat, 10 Nov 2007 01:57:35 +0000 (01:57 +0000)
committervda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>
Sat, 10 Nov 2007 01:57:35 +0000 (01:57 +0000)
git-svn-id: svn://busybox.net/trunk/busybox@20402 69ca8d6d-28ef-0310-b511-8ec308f3f277

init/init.c

index 4b543a4..9891087 100644 (file)
@@ -370,13 +370,12 @@ static pid_t run(const struct init_action *a)
 
                /* Now fork off another process to just hang around */
                pid = fork();
-               if (pid) {
+               if (pid < 0) {
                        message(L_LOG | L_CONSOLE, "Can't fork");
                        _exit(1);
                }
 
                if (pid > 0) {
-
                        /* We are the parent -- wait till the child is done */
                        signal(SIGINT, SIG_IGN);
                        signal(SIGTSTP, SIG_IGN);