aboutsummaryrefslogtreecommitdiff
path: root/poweroff.c
diff options
context:
space:
mode:
authorandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2001-07-05 16:09:32 +0000
committerandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2001-07-05 16:09:32 +0000
commit4f06e43e505742113fc7cec3bfcc31db7ade5dcd (patch)
tree82258933d427e54a38477106b221e21bcdd1232e /poweroff.c
parent42b9b7008e4d14cfd38005f2923cfa33d8dca0de (diff)
downloadbusybox-w32-4f06e43e505742113fc7cec3bfcc31db7ade5dcd.tar.gz
busybox-w32-4f06e43e505742113fc7cec3bfcc31db7ade5dcd.tar.bz2
busybox-w32-4f06e43e505742113fc7cec3bfcc31db7ade5dcd.zip
Be extra extra careful about what we dereference.
git-svn-id: svn://busybox.net/trunk/busybox@3004 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'poweroff.c')
-rw-r--r--poweroff.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/poweroff.c b/poweroff.c
index 007099d4d..8bb20e9bb 100644
--- a/poweroff.c
+++ b/poweroff.c
@@ -28,7 +28,10 @@ extern int poweroff_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")), SIGUSR2)); 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, SIGUSR2));
32#else 35#else
33 return(kill(1, SIGUSR2)); 36 return(kill(1, SIGUSR2));
34#endif 37#endif