use the pedantically correct compiler for preprocessing
[oweals/busybox.git] / reboot.c
index 17ec9f82ff806d17377fbbafbcd29e5f9054ec57..35c147b341080eef67427919f613070acb1e8be7 100644 (file)
--- a/reboot.c
+++ b/reboot.c
@@ -1,3 +1,4 @@
+/* vi: set sw=4 ts=4: */
 /*
  * Mini reboot implementation for busybox
  *
  *
  */
 
-#include "internal.h"
+#include "busybox.h"
 #include <signal.h>
 
-extern int
-reboot_main(int argc, char ** argv)
+extern int reboot_main(int argc, char **argv)
 {
+#ifdef BB_FEATURE_LINUXRC
        /* don't assume init's pid == 1 */
-       exit( kill(findInitPid(), SIGUSR2));
+       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
 }
+
+/*
+Local Variables:
+c-file-style: "linux"
+c-basic-offset: 4
+tab-width: 4
+End:
+*/