summaryrefslogtreecommitdiff
path: root/src/systemctl
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-05-08 19:02:25 +0200
committerLennart Poettering <lennart@poettering.net>2012-05-08 19:02:25 +0200
commitd889a2069a87e4617b32ddbdeace5a53a12c699d (patch)
tree7b83f31c7e3f02fda73d4e208598bd93713f9685 /src/systemctl
parent6edd7d0a09171ea5ae8e01b7b1cbcb0bdfbfeb16 (diff)
logind: implement suspend/hibernate calls with inhibition logic
Diffstat (limited to 'src/systemctl')
-rw-r--r--src/systemctl/systemctl.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 762b5be346..4708a35835 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -1750,6 +1750,14 @@ static int reboot_with_logind(DBusConnection *bus, enum action a) {
method = "PowerOff";
break;
+ case ACTION_SUSPEND:
+ method = "Suspend";
+ break;
+
+ case ACTION_HIBERNATE:
+ method = "Hibernate";
+ break;
+
default:
return -EINVAL;
}
@@ -1839,7 +1847,9 @@ static int start_special(DBusConnection *bus, char **args) {
/* first try logind, to allow authentication with polkit */
if (geteuid() != 0 &&
(a == ACTION_POWEROFF ||
- a == ACTION_REBOOT)) {
+ a == ACTION_REBOOT ||
+ a == ACTION_SUSPEND ||
+ a == ACTION_HIBERNATE)) {
r = reboot_with_logind(bus, a);
if (r >= 0)
return r;