From 62fda9612070cd578f4225e7e924b64beaf82700 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Thu, 18 Oct 2001 04:05:28 +0000 Subject: [PATCH] Fix a nasty bug resulting from variable name shadowing --- busybox/halt.c | 2 +- busybox/init/halt.c | 2 +- busybox/init/poweroff.c | 2 +- busybox/init/reboot.c | 2 +- busybox/poweroff.c | 2 +- busybox/reboot.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/busybox/halt.c b/busybox/halt.c index a6fec021b..d66e28d0e 100644 --- a/busybox/halt.c +++ b/busybox/halt.c @@ -30,7 +30,7 @@ extern int halt_main(int argc, char **argv) /* don't assume init's pid == 1 */ pid_t *pid = find_pid_by_name("init"); if (!pid || *pid<=0) { - pid_t *pid = find_pid_by_name("linuxrc"); + pid = find_pid_by_name("linuxrc"); if (!pid || *pid<=0) error_msg_and_die("no process killed"); } diff --git a/busybox/init/halt.c b/busybox/init/halt.c index a6fec021b..d66e28d0e 100644 --- a/busybox/init/halt.c +++ b/busybox/init/halt.c @@ -30,7 +30,7 @@ extern int halt_main(int argc, char **argv) /* don't assume init's pid == 1 */ pid_t *pid = find_pid_by_name("init"); if (!pid || *pid<=0) { - pid_t *pid = find_pid_by_name("linuxrc"); + pid = find_pid_by_name("linuxrc"); if (!pid || *pid<=0) error_msg_and_die("no process killed"); } diff --git a/busybox/init/poweroff.c b/busybox/init/poweroff.c index eba51342c..db20a4572 100644 --- a/busybox/init/poweroff.c +++ b/busybox/init/poweroff.c @@ -30,7 +30,7 @@ extern int poweroff_main(int argc, char **argv) /* don't assume init's pid == 1 */ pid_t *pid = find_pid_by_name("init"); if (!pid || *pid<=0) { - pid_t *pid = find_pid_by_name("linuxrc"); + pid = find_pid_by_name("linuxrc"); if (!pid || *pid<=0) error_msg_and_die("no process killed"); } diff --git a/busybox/init/reboot.c b/busybox/init/reboot.c index bdcd443eb..35afd74ff 100644 --- a/busybox/init/reboot.c +++ b/busybox/init/reboot.c @@ -30,7 +30,7 @@ extern int reboot_main(int argc, char **argv) /* don't assume init's pid == 1 */ pid_t *pid = find_pid_by_name("init"); if (!pid || *pid<=0) { - pid_t *pid = find_pid_by_name("linuxrc"); + pid = find_pid_by_name("linuxrc"); if (!pid || *pid<=0) error_msg_and_die("no process killed"); } diff --git a/busybox/poweroff.c b/busybox/poweroff.c index eba51342c..db20a4572 100644 --- a/busybox/poweroff.c +++ b/busybox/poweroff.c @@ -30,7 +30,7 @@ extern int poweroff_main(int argc, char **argv) /* don't assume init's pid == 1 */ pid_t *pid = find_pid_by_name("init"); if (!pid || *pid<=0) { - pid_t *pid = find_pid_by_name("linuxrc"); + pid = find_pid_by_name("linuxrc"); if (!pid || *pid<=0) error_msg_and_die("no process killed"); } diff --git a/busybox/reboot.c b/busybox/reboot.c index bdcd443eb..35afd74ff 100644 --- a/busybox/reboot.c +++ b/busybox/reboot.c @@ -30,7 +30,7 @@ extern int reboot_main(int argc, char **argv) /* don't assume init's pid == 1 */ pid_t *pid = find_pid_by_name("init"); if (!pid || *pid<=0) { - pid_t *pid = find_pid_by_name("linuxrc"); + pid = find_pid_by_name("linuxrc"); if (!pid || *pid<=0) error_msg_and_die("no process killed"); } -- 2.25.1