summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--halt.c7
-rw-r--r--init/halt.c7
-rw-r--r--init/poweroff.c7
-rw-r--r--init/reboot.c7
-rw-r--r--poweroff.c7
-rw-r--r--reboot.c7
6 files changed, 30 insertions, 12 deletions
diff --git a/halt.c b/halt.c
index 10dcb42..a6fec02 100644
--- a/halt.c
+++ b/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/init/halt.c b/init/halt.c
index 10dcb42..a6fec02 100644
--- a/init/halt.c
+++ b/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/init/poweroff.c b/init/poweroff.c
index 8bb20e9..eba5134 100644
--- a/init/poweroff.c
+++ b/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/init/reboot.c b/init/reboot.c
index 35c147b..bdcd443 100644
--- a/init/reboot.c
+++ b/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/poweroff.c b/poweroff.c
index 8bb20e9..eba5134 100644
--- a/poweroff.c
+++ b/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/reboot.c b/reboot.c
index 35c147b..bdcd443 100644
--- a/reboot.c
+++ b/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));