mirror of
https://github.com/sheumann/hush.git
synced 2024-12-21 23:29:34 +00:00
Look for either "init" or "linuxrc" processes
This commit is contained in:
parent
f0a4ac8216
commit
371ca19f53
7
halt.c
7
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));
|
||||
|
@ -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));
|
||||
|
@ -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));
|
||||
|
@ -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));
|
||||
|
@ -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));
|
||||
|
7
reboot.c
7
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));
|
||||
|
Loading…
Reference in New Issue
Block a user