Look for "init" or "linuxrc" when rebooting
authorEric Andersen <andersen@codepoet.org>
Wed, 3 Oct 2001 21:38:18 +0000 (21:38 -0000)
committerEric Andersen <andersen@codepoet.org>
Wed, 3 Oct 2001 21:38:18 +0000 (21:38 -0000)
busybox/halt.c
busybox/init/halt.c
busybox/init/poweroff.c
busybox/init/reboot.c
busybox/poweroff.c
busybox/reboot.c

index 10dcb4225eadedcf72f216c3dceef541bb56076a..a6fec021bfe8230086dbf6108755496c0f96620c 100644 (file)
@@ -29,8 +29,11 @@ extern int halt_main(int argc, char **argv)
 #ifdef BB_FEATURE_LINUXRC
        /* don't assume init's pid == 1 */
        pid_t *pid = find_pid_by_name("init");
-       if (!pid || *pid<=0)
-               error_msg_and_die("no process killed");
+       if (!pid || *pid<=0) {
+               pid_t *pid = find_pid_by_name("linuxrc");
+               if (!pid || *pid<=0)
+                       error_msg_and_die("no process killed");
+       }
        return(kill(*pid, SIGUSR1));
 #else
        return(kill(1, SIGUSR1));
index 10dcb4225eadedcf72f216c3dceef541bb56076a..a6fec021bfe8230086dbf6108755496c0f96620c 100644 (file)
@@ -29,8 +29,11 @@ extern int halt_main(int argc, char **argv)
 #ifdef BB_FEATURE_LINUXRC
        /* don't assume init's pid == 1 */
        pid_t *pid = find_pid_by_name("init");
-       if (!pid || *pid<=0)
-               error_msg_and_die("no process killed");
+       if (!pid || *pid<=0) {
+               pid_t *pid = find_pid_by_name("linuxrc");
+               if (!pid || *pid<=0)
+                       error_msg_and_die("no process killed");
+       }
        return(kill(*pid, SIGUSR1));
 #else
        return(kill(1, SIGUSR1));
index 8bb20e9bbb949ef5a1159896c9de61ffa777fc0d..eba51342cc62e3903722337c167e22ed46cfacd9 100644 (file)
@@ -29,8 +29,11 @@ extern int poweroff_main(int argc, char **argv)
 #ifdef BB_FEATURE_LINUXRC
        /* don't assume init's pid == 1 */
        pid_t *pid = find_pid_by_name("init");
-       if (!pid || *pid<=0)
-               error_msg_and_die("no process killed");
+       if (!pid || *pid<=0) {
+               pid_t *pid = find_pid_by_name("linuxrc");
+               if (!pid || *pid<=0)
+                       error_msg_and_die("no process killed");
+       }
        return(kill(*pid, SIGUSR2));
 #else
        return(kill(1, SIGUSR2));
index 35c147b341080eef67427919f613070acb1e8be7..bdcd443eb01aeb22b845170871bee74f8568b3ed 100644 (file)
@@ -29,8 +29,11 @@ extern int reboot_main(int argc, char **argv)
 #ifdef BB_FEATURE_LINUXRC
        /* don't assume init's pid == 1 */
        pid_t *pid = find_pid_by_name("init");
-       if (!pid || *pid<=0)
-               error_msg_and_die("no process killed");
+       if (!pid || *pid<=0) {
+               pid_t *pid = find_pid_by_name("linuxrc");
+               if (!pid || *pid<=0)
+                       error_msg_and_die("no process killed");
+       }
        return(kill(*pid, SIGTERM));
 #else
        return(kill(1, SIGTERM));
index 8bb20e9bbb949ef5a1159896c9de61ffa777fc0d..eba51342cc62e3903722337c167e22ed46cfacd9 100644 (file)
@@ -29,8 +29,11 @@ extern int poweroff_main(int argc, char **argv)
 #ifdef BB_FEATURE_LINUXRC
        /* don't assume init's pid == 1 */
        pid_t *pid = find_pid_by_name("init");
-       if (!pid || *pid<=0)
-               error_msg_and_die("no process killed");
+       if (!pid || *pid<=0) {
+               pid_t *pid = find_pid_by_name("linuxrc");
+               if (!pid || *pid<=0)
+                       error_msg_and_die("no process killed");
+       }
        return(kill(*pid, SIGUSR2));
 #else
        return(kill(1, SIGUSR2));
index 35c147b341080eef67427919f613070acb1e8be7..bdcd443eb01aeb22b845170871bee74f8568b3ed 100644 (file)
@@ -29,8 +29,11 @@ extern int reboot_main(int argc, char **argv)
 #ifdef BB_FEATURE_LINUXRC
        /* don't assume init's pid == 1 */
        pid_t *pid = find_pid_by_name("init");
-       if (!pid || *pid<=0)
-               error_msg_and_die("no process killed");
+       if (!pid || *pid<=0) {
+               pid_t *pid = find_pid_by_name("linuxrc");
+               if (!pid || *pid<=0)
+                       error_msg_and_die("no process killed");
+       }
        return(kill(*pid, SIGTERM));
 #else
        return(kill(1, SIGTERM));