diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-07-05 20:09:32 +0400 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-07-05 20:09:32 +0400 |
commit | 332394b577d75669cd30c3ea884e9152d63366f8 (patch) | |
tree | 82258933d427e54a38477106b221e21bcdd1232e /init/halt.c | |
parent | d50a61956c032c9b80bee7dc58a931318d8f38da (diff) |
Be extra extra careful about what we dereference.
Diffstat (limited to 'init/halt.c')
-rw-r--r-- | init/halt.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/init/halt.c b/init/halt.c index e875d04f0..10dcb4225 100644 --- a/init/halt.c +++ b/init/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 |