summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-06-06 21:45:12 +0200
committerLennart Poettering <lennart@poettering.net>2016-06-10 20:02:16 +0200
commit033f0ab85d9cc5e8ae66e07d4740482abb5617ef (patch)
tree473dad6b53745ea93fc2f06b2cb9c8d66771fa82
parent64c3610b55799c738e4fdc7236fadd635649c0f4 (diff)
systemctl: don't suppress error code when handling legacy commands
For legacy commands such as /sbin/halt or /sbin/poweroff we support legacy fallbacks that talk via traditional SysV way with PID 1 to issue the desired operation. We do this on any kind of error if the primary method of operation fails. When this is the case we suppress any error message that is normally generated, in order to not confuse the user. When suppressing this log message, don't suppress the original error code, because there's really no reason to.
-rw-r--r--src/systemctl/systemctl.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index df41182529..9ff460d158 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -2693,10 +2693,9 @@ static int start_unit_one(
if (r < 0) {
const char *verb;
- if (r == -ENOENT && arg_action != ACTION_SYSTEMCTL)
- /* There's always a fallback possible for
- * legacy actions. */
- return -EADDRNOTAVAIL;
+ /* There's always a fallback possible for legacy actions. */
+ if (arg_action != ACTION_SYSTEMCTL)
+ return r;
verb = method_to_verb(method);