[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[sysvinit-devel] shutdown: do not require -h when using -H/-P
From: |
Mike Frysinger |
Subject: |
[sysvinit-devel] shutdown: do not require -h when using -H/-P |
Date: |
Sat, 15 Feb 2014 21:30:51 -0500 |
User-agent: |
KMail/4.12.2 (Linux/3.13.0; KDE/4.12.2; x86_64; ; ) |
From: Doug Goldstein <address@hidden>
Other inits have moved to not requiring the -h flag when used with -H/-P.
modify sysvinit to be the same since it really doesn't matter.
URL: https://bugs.gentoo.org/449354
---
man/shutdown.8 | 7 +++----
src/shutdown.c | 10 ++++------
2 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/man/shutdown.8 b/man/shutdown.8
index 919a77e..c81958a 100644
--- a/man/shutdown.8
+++ b/man/shutdown.8
@@ -66,16 +66,15 @@ Reboot after shutdown.
.\"}}}
.\"{{{ -h
.IP \fB\-h\fP
-Halt or power off after shutdown.
+Equivalent to -P, unless -H is specified.
.\"}}}
.\"{{{ -P
.IP \fB\-P\fP
-Halt action is to turn off the power.
+Action is to power-off the machine.
.\"}}}
.\"{{{ -H
.IP \fB\-H\fP
-Modifier to the -h flag. Halt action is to halt or drop into boot
-monitor on systems that support it. Must be used with the -h flag.
+Action is to halt the machine.
.\"}}}
.\"{{{ -f
.IP \fB\-f\fP
diff --git a/src/shutdown.c b/src/shutdown.c
index 11c616f..503c2d6 100644
--- a/src/shutdown.c
+++ b/src/shutdown.c
@@ -513,9 +513,11 @@ int main(int argc, char **argv)
switch(c) {
case 'H':
halttype = "HALT";
+ down_level[0] = '0';
break;
case 'P':
halttype = "POWERDOWN";
+ down_level[0] = '0';
break;
case 'a': /* Access control. */
useacl = 1;
@@ -531,6 +533,8 @@ int main(int argc, char **argv)
break;
case 'h': /* Halt after shutdown */
down_level[0] = '0';
+ if (!halttype)
+ halttype = "POWERDOWN";
break;
case 'f': /* Don't perform fsck after next boot */
fastboot = 1;
@@ -564,12 +568,6 @@ int main(int argc, char **argv)
}
}
- if (NULL != halttype && down_level[0] != '0') {
- fprintf(stderr, "shutdown: -H and -P flags can only be used
along with -h flag.\n");
- usage();
- exit(1);
- }
-
/* Do we need to use the shutdown.allow file ? */
if (useacl && (fp = fopen(SDALLOW, "r")) != NULL) {
--
1.8.5.5
- [sysvinit-devel] shutdown: do not require -h when using -H/-P,
Mike Frysinger <=