{
static const int magic[] = {
#ifdef RB_HALT_SYSTEM
-RB_HALT_SYSTEM,
+ RB_HALT_SYSTEM,
#elif defined RB_HALT
-RB_HALT,
+ RB_HALT,
#endif
#ifdef RB_POWER_OFF
-RB_POWER_OFF,
+ RB_POWER_OFF,
#elif defined RB_POWERDOWN
-RB_POWERDOWN,
+ RB_POWERDOWN,
#endif
-RB_AUTOBOOT
+ RB_AUTOBOOT
};
static const smallint signals[] = { SIGUSR1, SIGUSR2, SIGTERM };
int delay = 0;
- int which, flags, rc = 1;
+ int which, flags, rc;
#if ENABLE_FEATURE_WTMP
struct utmp utmp;
struct utsname uts;
/* Parse and handle arguments */
opt_complementary = "d+"; /* -d N */
- flags = getopt32(argv, "d:nfw", &delay);
+ flags = getopt32(argv, "d:nf" USE_FEATURE_WTMP("w"), &delay);
sleep(delay);
if (uname(&uts) == 0)
safe_strncpy(utmp.ut_host, uts.release, sizeof(utmp.ut_host));
updwtmp(bb_path_wtmp_file, &utmp);
-#endif /* !ENABLE_FEATURE_WTMP */
if (flags & 8) /* -w */
- return 0;
+ return EXIT_SUCCESS;
+#endif /* !ENABLE_FEATURE_WTMP */
+
if (!(flags & 2)) /* no -n */
sync();
/* Perform action. */
- if (ENABLE_INIT && !(flags & 4)) {
+ rc = 1;
+ if (!(flags & 4)) { /* no -f */
+//TODO: I tend to think that signalling linuxrc is wrong
+// pity original author didn't comment on it...
if (ENABLE_FEATURE_INITRD) {
pid_t *pidlist = find_pid_by_name("linuxrc");
if (pidlist[0] > 0)