2014-01-28 13:57:54 +01:00
|
|
|
---
|
2014-11-13 14:01:19 +01:00
|
|
|
systemd-209/src/core/shutdown.c | 4 ++++
|
|
|
|
systemd-209/src/systemctl/systemctl.c | 22 +++++++++++++++-------
|
|
|
|
2 files changed, 19 insertions(+), 7 deletions(-)
|
2014-01-28 13:57:54 +01:00
|
|
|
|
2014-02-28 18:10:52 +01:00
|
|
|
--- systemd-209/src/core/shutdown.c
|
|
|
|
+++ systemd-209/src/core/shutdown.c 2014-02-28 11:17:22.000000000 +0000
|
2014-11-13 14:01:19 +01:00
|
|
|
@@ -449,6 +449,10 @@ int main(int argc, char *argv[]) {
|
2014-02-28 18:10:52 +01:00
|
|
|
}
|
2014-01-28 13:57:54 +01:00
|
|
|
|
2014-02-28 18:10:52 +01:00
|
|
|
reboot(cmd);
|
|
|
|
+
|
2014-11-13 14:01:19 +01:00
|
|
|
+ if (cmd == (int)RB_POWER_OFF)
|
2014-02-28 18:10:52 +01:00
|
|
|
+ reboot(RB_HALT_SYSTEM);
|
|
|
|
+
|
|
|
|
if (errno == EPERM && in_container) {
|
|
|
|
/* If we are in a container, and we lacked
|
|
|
|
* CAP_SYS_BOOT just exit, this will kill our
|
|
|
|
--- systemd-209/src/systemctl/systemctl.c
|
|
|
|
+++ systemd-209/src/systemctl/systemctl.c 2014-02-28 11:19:35.000000000 +0000
|
2014-11-13 14:01:19 +01:00
|
|
|
@@ -93,6 +93,7 @@ static bool arg_no_pager = false;
|
2014-01-28 13:57:54 +01:00
|
|
|
static bool arg_no_wtmp = false;
|
|
|
|
static bool arg_no_wall = false;
|
|
|
|
static bool arg_no_reload = false;
|
|
|
|
+static bool arg_no_sync = false;
|
|
|
|
static bool arg_show_types = false;
|
|
|
|
static bool arg_ignore_inhibitors = false;
|
|
|
|
static bool arg_dry = false;
|
2014-11-13 14:01:19 +01:00
|
|
|
@@ -5578,6 +5579,7 @@ static int halt_parse_argv(int argc, cha
|
2014-01-28 13:57:54 +01:00
|
|
|
{ "reboot", no_argument, NULL, ARG_REBOOT },
|
|
|
|
{ "force", no_argument, NULL, 'f' },
|
|
|
|
{ "wtmp-only", no_argument, NULL, 'w' },
|
|
|
|
+ { "no-sync", no_argument, NULL, 'n' },
|
|
|
|
{ "no-wtmp", no_argument, NULL, 'd' },
|
|
|
|
{ "no-wall", no_argument, NULL, ARG_NO_WALL },
|
2014-02-28 18:10:52 +01:00
|
|
|
{}
|
2014-11-13 14:01:19 +01:00
|
|
|
@@ -5629,10 +5631,13 @@ static int halt_parse_argv(int argc, cha
|
2014-01-28 13:57:54 +01:00
|
|
|
|
|
|
|
case 'i':
|
|
|
|
case 'h':
|
|
|
|
- case 'n':
|
|
|
|
/* Compatibility nops */
|
|
|
|
break;
|
|
|
|
|
|
|
|
+ case 'n':
|
|
|
|
+ arg_no_sync = true;
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
case '?':
|
|
|
|
return -EINVAL;
|
|
|
|
|
2014-11-13 14:01:19 +01:00
|
|
|
@@ -6274,20 +6279,23 @@ done:
|
|
|
|
|
|
|
|
static int halt_now(enum action a) {
|
2014-01-28 13:57:54 +01:00
|
|
|
|
2014-11-13 14:01:19 +01:00
|
|
|
-/* Make sure C-A-D is handled by the kernel from this
|
2014-02-20 13:23:32 +01:00
|
|
|
+ if (!arg_no_sync)
|
|
|
|
+ sync();
|
2014-11-13 14:01:19 +01:00
|
|
|
+
|
|
|
|
+ /* Make sure C-A-D is handled by the kernel from this
|
|
|
|
* point on... */
|
|
|
|
reboot(RB_ENABLE_CAD);
|
|
|
|
|
|
|
|
switch (a) {
|
2014-01-28 13:57:54 +01:00
|
|
|
|
|
|
|
- case ACTION_HALT:
|
|
|
|
- log_info("Halting.");
|
|
|
|
- reboot(RB_HALT_SYSTEM);
|
|
|
|
- return -errno;
|
2014-11-13 14:01:19 +01:00
|
|
|
-
|
2014-01-28 13:57:54 +01:00
|
|
|
case ACTION_POWEROFF:
|
|
|
|
log_info("Powering off.");
|
|
|
|
reboot(RB_POWER_OFF);
|
|
|
|
+ /* Fall through */
|
|
|
|
+
|
|
|
|
+ case ACTION_HALT:
|
|
|
|
+ log_info("Halting.");
|
|
|
|
+ reboot(RB_HALT_SYSTEM);
|
|
|
|
return -errno;
|
|
|
|
|
2014-02-28 18:10:52 +01:00
|
|
|
case ACTION_REBOOT: {
|