commit | 332394b577d75669cd30c3ea884e9152d63366f8 | [log] [tgz] |
---|---|---|
author | Eric Andersen <andersen@codepoet.org> | Thu Jul 05 16:09:32 2001 +0000 |
committer | Eric Andersen <andersen@codepoet.org> | Thu Jul 05 16:09:32 2001 +0000 |
tree | 82258933d427e54a38477106b221e21bcdd1232e | |
parent | d50a61956c032c9b80bee7dc58a931318d8f38da [diff] [blame] |
Be extra extra careful about what we dereference.
diff --git a/init/reboot.c b/init/reboot.c index 74d2cf6..35c147b 100644 --- a/init/reboot.c +++ b/init/reboot.c
@@ -28,7 +28,10 @@ { #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