]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemctl: don't suppress error code when handling legacy commands
authorLennart Poettering <lennart@poettering.net>
Mon, 6 Jun 2016 19:45:12 +0000 (21:45 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 10 Jun 2016 18:02:16 +0000 (20:02 +0200)
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.

src/systemctl/systemctl.c

index df4118252929176972b7688eb471b89b57750fd8..9ff460d158518f6d562c343b7eafd03af8ebc939 100644 (file)
@@ -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);