projects
/
oweals
/
busybox.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
- halt's -w depends on FEATURE_WTMP (Vladimir Dronnikov)
[oweals/busybox.git]
/
init
/
halt.c
diff --git
a/init/halt.c
b/init/halt.c
index 207069e12eb00ce6af4336c6ef8ef7c3290af706..42b9edc08f849d364b8b68a12f109d7eb204dd07 100644
(file)
--- a/
init/halt.c
+++ b/
init/halt.c
@@
-20,21
+20,21
@@
int halt_main(int argc UNUSED_PARAM, char **argv)
{
static const int magic[] = {
#ifdef RB_HALT_SYSTEM
{
static const int magic[] = {
#ifdef RB_HALT_SYSTEM
-RB_HALT_SYSTEM,
+
RB_HALT_SYSTEM,
#elif defined RB_HALT
#elif defined RB_HALT
-RB_HALT,
+
RB_HALT,
#endif
#ifdef RB_POWER_OFF
#endif
#ifdef RB_POWER_OFF
-RB_POWER_OFF,
+
RB_POWER_OFF,
#elif defined RB_POWERDOWN
#elif defined RB_POWERDOWN
-RB_POWERDOWN,
+
RB_POWERDOWN,
#endif
#endif
-RB_AUTOBOOT
+
RB_AUTOBOOT
};
static const smallint signals[] = { SIGUSR1, SIGUSR2, SIGTERM };
int delay = 0;
};
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;
#if ENABLE_FEATURE_WTMP
struct utmp utmp;
struct utsname uts;
@@
-46,7
+46,7
@@
RB_AUTOBOOT
/* Parse and handle arguments */
opt_complementary = "d+"; /* -d N */
/* Parse and handle arguments */
opt_complementary = "d+"; /* -d N */
- flags = getopt32(argv, "d:nf
w"
, &delay);
+ flags = getopt32(argv, "d:nf
" USE_FEATURE_WTMP("w")
, &delay);
sleep(delay);
sleep(delay);
@@
-63,15
+63,19
@@
RB_AUTOBOOT
if (uname(&uts) == 0)
safe_strncpy(utmp.ut_host, uts.release, sizeof(utmp.ut_host));
updwtmp(bb_path_wtmp_file, &utmp);
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 */
if (flags & 8) /* -w */
- return 0;
+ return EXIT_SUCCESS;
+#endif /* !ENABLE_FEATURE_WTMP */
+
if (!(flags & 2)) /* no -n */
sync();
/* Perform action. */
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)
if (ENABLE_FEATURE_INITRD) {
pid_t *pidlist = find_pid_by_name("linuxrc");
if (pidlist[0] > 0)