diff options
Diffstat (limited to 'init/reboot.c')
-rw-r--r-- | init/reboot.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/init/reboot.c b/init/reboot.c index 74d2cf643..35c147b34 100644 --- a/init/reboot.c +++ b/init/reboot.c @@ -28,7 +28,10 @@ extern int reboot_main(int argc, char **argv) { #ifdef BB_FEATURE_LINUXRC /* don't assume init's pid == 1 */ - return(kill(*(find_pid_by_name("init")), SIGTERM)); + pid_t *pid = find_pid_by_name("init"); + if (!pid || *pid<=0) + error_msg_and_die("no process killed"); + return(kill(*pid, SIGTERM)); #else return(kill(1, SIGTERM)); #endif |