forked from pool/systemd
86 lines
2.5 KiB
Diff
86 lines
2.5 KiB
Diff
|
--- systemd-208/src/core/shutdown.c
|
||
|
+++ systemd-208/src/core/shutdown.c 2014-01-27 11:31:38.486235816 +0000
|
||
|
@@ -329,6 +329,9 @@ int main(int argc, char *argv[]) {
|
||
|
|
||
|
reboot(cmd);
|
||
|
|
||
|
+ if (cmd == RB_POWER_OFF)
|
||
|
+ 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-208/src/systemctl/systemctl.c
|
||
|
+++ systemd-208/src/systemctl/systemctl.c 2014-01-27 11:05:18.298236035 +0000
|
||
|
@@ -138,7 +138,7 @@ static bool arg_plain = false;
|
||
|
static bool private_bus = false;
|
||
|
|
||
|
static int daemon_reload(DBusConnection *bus, char **args);
|
||
|
-static void halt_now(enum action a);
|
||
|
+static int halt_now(enum action a);
|
||
|
|
||
|
static void pager_open_if_enabled(void) {
|
||
|
|
||
|
@@ -2227,7 +2227,7 @@ static int start_special(DBusConnection
|
||
|
(a == ACTION_HALT ||
|
||
|
a == ACTION_POWEROFF ||
|
||
|
a == ACTION_REBOOT))
|
||
|
- halt_now(a);
|
||
|
+ return halt_now(a);
|
||
|
|
||
|
if (arg_force >= 1 &&
|
||
|
(a == ACTION_HALT ||
|
||
|
@@ -5973,7 +5973,7 @@ done:
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
-static _noreturn_ void halt_now(enum action a) {
|
||
|
+static int halt_now(enum action a) {
|
||
|
|
||
|
/* Make sure C-A-D is handled by the kernel from this
|
||
|
* point on... */
|
||
|
@@ -5984,23 +5984,22 @@ static _noreturn_ void halt_now(enum act
|
||
|
case ACTION_HALT:
|
||
|
log_info("Halting.");
|
||
|
reboot(RB_HALT_SYSTEM);
|
||
|
- break;
|
||
|
+ return -errno;
|
||
|
|
||
|
case ACTION_POWEROFF:
|
||
|
log_info("Powering off.");
|
||
|
reboot(RB_POWER_OFF);
|
||
|
- break;
|
||
|
+ return -errno;
|
||
|
|
||
|
case ACTION_REBOOT:
|
||
|
log_info("Rebooting.");
|
||
|
reboot(RB_AUTOBOOT);
|
||
|
- break;
|
||
|
+ return -errno;
|
||
|
|
||
|
default:
|
||
|
- assert_not_reached("Unknown halt action.");
|
||
|
+ assert_not_reached("Unknown action.");
|
||
|
+ return -ENOSYS;
|
||
|
}
|
||
|
-
|
||
|
- assert_not_reached("Uh? This shouldn't happen.");
|
||
|
}
|
||
|
|
||
|
static int halt_main(DBusConnection *bus) {
|
||
|
@@ -6069,9 +6068,10 @@ static int halt_main(DBusConnection *bus
|
||
|
if (arg_dry)
|
||
|
return 0;
|
||
|
|
||
|
- halt_now(arg_action);
|
||
|
- /* We should never reach this. */
|
||
|
- return -ENOSYS;
|
||
|
+ r = halt_now(arg_action);
|
||
|
+ log_error("Failed to reboot: %s", strerror(-r));
|
||
|
+
|
||
|
+ return r;
|
||
|
}
|
||
|
|
||
|
static int runlevel_main(void) {
|