chiark / gitweb /
logind: implement suspend/hibernate calls with inhibition logic
[elogind.git] / src / systemctl / systemctl.c
index 762b5be3463288b92cb0218535868f9887747c1d..4708a35835c0b41bf8938e08f7f493151d3c69d9 100644 (file)
@@ -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;