summaryrefslogtreecommitdiff
path: root/halt.c
diff options
context:
space:
mode:
Diffstat (limited to 'halt.c')
-rw-r--r--halt.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/halt.c b/halt.c
index e875d04..10dcb42 100644
--- a/halt.c
+++ b/halt.c
@@ -28,7 +28,10 @@ extern int halt_main(int argc, char **argv)
{
#ifdef BB_FEATURE_LINUXRC
/* don't assume init's pid == 1 */
- return(kill(*(find_pid_by_name("init")), SIGUSR1));
+ pid_t *pid = find_pid_by_name("init");
+ if (!pid || *pid<=0)
+ error_msg_and_die("no process killed");
+ return(kill(*pid, SIGUSR1));
#else
return(kill(1, SIGUSR1));
#endif