From: Eric Andersen Date: Wed, 3 Oct 2001 21:38:18 +0000 (-0000) Subject: Look for "init" or "linuxrc" when rebooting X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=0eaef548784d1a85b45945e85596618e2a2d8496;p=oweals%2Fbusybox.git Look for "init" or "linuxrc" when rebooting --- diff --git a/busybox/halt.c b/busybox/halt.c index 10dcb4225..a6fec021b 100644 --- a/busybox/halt.c +++ b/busybox/halt.c @@ -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)); diff --git a/busybox/init/halt.c b/busybox/init/halt.c index 10dcb4225..a6fec021b 100644 --- a/busybox/init/halt.c +++ b/busybox/init/halt.c @@ -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)); diff --git a/busybox/init/poweroff.c b/busybox/init/poweroff.c index 8bb20e9bb..eba51342c 100644 --- a/busybox/init/poweroff.c +++ b/busybox/init/poweroff.c @@ -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)); diff --git a/busybox/init/reboot.c b/busybox/init/reboot.c index 35c147b34..bdcd443eb 100644 --- a/busybox/init/reboot.c +++ b/busybox/init/reboot.c @@ -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)); diff --git a/busybox/poweroff.c b/busybox/poweroff.c index 8bb20e9bb..eba51342c 100644 --- a/busybox/poweroff.c +++ b/busybox/poweroff.c @@ -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)); diff --git a/busybox/reboot.c b/busybox/reboot.c index 35c147b34..bdcd443eb 100644 --- a/busybox/reboot.c +++ b/busybox/reboot.c @@ -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));