aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--halt.c3
-rw-r--r--init/halt.c3
-rw-r--r--init/reboot.c4
-rw-r--r--reboot.c4
-rw-r--r--utility.c9
5 files changed, 15 insertions, 8 deletions
diff --git a/halt.c b/halt.c
index ecc6e8f30..23eb23c30 100644
--- a/halt.c
+++ b/halt.c
@@ -26,6 +26,7 @@
extern int
halt_main(int argc, char ** argv)
{
- exit( kill(1, SIGUSR1));
+ /* don't assume init's pid == 1 */
+ exit( kill(findInitPid(), SIGUSR1));
}
diff --git a/init/halt.c b/init/halt.c
index ecc6e8f30..23eb23c30 100644
--- a/init/halt.c
+++ b/init/halt.c
@@ -26,6 +26,7 @@
extern int
halt_main(int argc, char ** argv)
{
- exit( kill(1, SIGUSR1));
+ /* don't assume init's pid == 1 */
+ exit( kill(findInitPid(), SIGUSR1));
}
diff --git a/init/reboot.c b/init/reboot.c
index 17ec9f82f..ff2c6ad18 100644
--- a/init/reboot.c
+++ b/init/reboot.c
@@ -26,6 +26,6 @@
extern int
reboot_main(int argc, char ** argv)
{
- /* don't assume init's pid == 1 */
- exit( kill(findInitPid(), SIGUSR2));
+ /* don't assume init's pid == 1 */
+ exit( kill(findInitPid(), SIGUSR2));
}
diff --git a/reboot.c b/reboot.c
index 17ec9f82f..ff2c6ad18 100644
--- a/reboot.c
+++ b/reboot.c
@@ -26,6 +26,6 @@
extern int
reboot_main(int argc, char ** argv)
{
- /* don't assume init's pid == 1 */
- exit( kill(findInitPid(), SIGUSR2));
+ /* don't assume init's pid == 1 */
+ exit( kill(findInitPid(), SIGUSR2));
}
diff --git a/utility.c b/utility.c
index 42ee00c50..74df632b9 100644
--- a/utility.c
+++ b/utility.c
@@ -1068,7 +1068,12 @@ extern long getNum (const char *cp)
}
#endif
-#if 1
+
+#if defined BB_INIT || defined BB_HALT || defined BB_REBOOT
+
+#if ! defined BB_FEATURE_USE_PROCFS
+#error Sorry, I depend on the /proc filesystem right now.
+#endif
/* findInitPid()
*
* This finds the pid of init (which is not always 1).
@@ -1095,7 +1100,7 @@ findInitPid()
fgets(buffer, 256, status);
fclose(status);
- if ( (strcmp(&buffer[6], "init\n") == 0)) {
+ if ( (strstr(buffer, "init\n") != NULL )) {
return init_pid;
}
}