summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenry Tung <htung@palantir.com>2018-10-23 14:09:13 +0200
committerLennart Poettering <lennart@poettering.net>2018-11-16 15:52:22 +0100
commit0c093a62ef875ca4448cb9b778a2d1d7f3aec4a0 (patch)
tree02206c555dfeced528b9dd458ed77e2f658fa3f2
parentc78e6f9e7b29656faf130e697a74e7f30ccaf6a2 (diff)
downloadsystemd-0c093a62ef875ca4448cb9b778a2d1d7f3aec4a0.tar.gz
systemd-0c093a62ef875ca4448cb9b778a2d1d7f3aec4a0.tar.bz2
systemd-0c093a62ef875ca4448cb9b778a2d1d7f3aec4a0.zip
logind: fix determination of CanHibernate() and other calls
As suggest here: https://github.com/systemd/systemd/issues/10250#issuecomment-426788301 Fixes: #10250 (This suggested patch has been converted into a proper commit by me, Lennart, with attribution to the original author, @henryptung)
-rw-r--r--src/login/logind-dbus.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index 26253eb619..c0dafa03ef 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -2267,11 +2267,13 @@ static int method_can_shutdown_or_sleep(
if (r < 0)
return r;
- if (r > 0 && !result)
- result = "yes";
- else if (challenge && (!result || streq(result, "yes")))
- result = "challenge";
- else
+ if (r > 0) {
+ if (!result)
+ result = "yes";
+ } else if (challenge) {
+ if (!result || streq(result, "yes"))
+ result = "challenge";
+ } else
result = "no";
}