aboutsummaryrefslogtreecommitdiff
path: root/reboot.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-07-05 16:09:32 +0000
committerEric Andersen <andersen@codepoet.org>2001-07-05 16:09:32 +0000
commit332394b577d75669cd30c3ea884e9152d63366f8 (patch)
tree82258933d427e54a38477106b221e21bcdd1232e /reboot.c
parentd50a61956c032c9b80bee7dc58a931318d8f38da (diff)
downloadbusybox-w32-332394b577d75669cd30c3ea884e9152d63366f8.tar.gz
busybox-w32-332394b577d75669cd30c3ea884e9152d63366f8.tar.bz2
busybox-w32-332394b577d75669cd30c3ea884e9152d63366f8.zip
Be extra extra careful about what we dereference.
Diffstat (limited to '')
-rw-r--r--reboot.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/reboot.c b/reboot.c
index 74d2cf643..35c147b34 100644
--- a/reboot.c
+++ b/reboot.c
@@ -28,7 +28,10 @@ extern int reboot_main(int argc, char **argv)
28{ 28{
29#ifdef BB_FEATURE_LINUXRC 29#ifdef BB_FEATURE_LINUXRC
30 /* don't assume init's pid == 1 */ 30 /* don't assume init's pid == 1 */
31 return(kill(*(find_pid_by_name("init")), SIGTERM)); 31 pid_t *pid = find_pid_by_name("init");
32 if (!pid || *pid<=0)
33 error_msg_and_die("no process killed");
34 return(kill(*pid, SIGTERM));
32#else 35#else
33 return(kill(1, SIGTERM)); 36 return(kill(1, SIGTERM));
34#endif 37#endif