summaryrefslogtreecommitdiff
path: root/src/systemctl
diff options
context:
space:
mode:
authorIvan Shapovalov <intelfx100@gmail.com>2015-09-09 16:04:35 +0300
committerIvan Shapovalov <intelfx100@gmail.com>2015-09-10 14:44:59 +0300
commita9085ea35628fa0bfeb3b48fb53f7b823081ad09 (patch)
tree6daa47aee9f990ab1f7e158cd3e2e475ae5f88f7 /src/systemctl
parent4c315c2c7c859df318f70e7aa59697a6781c92aa (diff)
systemctl: fix logind bus call error handling in halt_main()
Handle -EOPNOTSUPP and -EINPROGRESS like in start_special().
Diffstat (limited to 'src/systemctl')
-rw-r--r--src/systemctl/systemctl.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 22455b5475..bde3607e21 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -3048,8 +3048,12 @@ static int start_special(sd_bus *bus, char **args) {
ACTION_HIBERNATE,
ACTION_HYBRID_SLEEP)) {
r = reboot_with_logind(bus, a);
- if (r >= 0 || IN_SET(r, -EOPNOTSUPP, -EINPROGRESS))
+ if (r >= 0)
return r;
+ if (IN_SET(r, -EOPNOTSUPP, -EINPROGRESS))
+ /* requested operation is not supported or already in progress */
+ return r;
+ /* on all other errors, try low-level operation */
}
r = start_unit(bus, args);
@@ -7378,6 +7382,10 @@ static int halt_main(sd_bus *bus) {
r = reboot_with_logind(bus, arg_action);
if (r >= 0)
return r;
+ if (IN_SET(r, -EOPNOTSUPP, -EINPROGRESS))
+ /* requested operation is not supported or already in progress */
+ return r;
+ /* on all other errors, try low-level operation */
}
log_error("Must be root.");