]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemctl: explicitly comment two cases where we don't log on error cases, on purpose
authorLennart Poettering <lennart@poettering.net>
Thu, 14 Jan 2021 14:02:27 +0000 (15:02 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 14 Jan 2021 14:02:27 +0000 (15:02 +0100)
src/systemctl/systemctl-util.c

index aff247a881b0e70adf84a2f7053008f91fa585d9..262854537dab058f539a66ad54c9ac8cd2c51b67 100644 (file)
@@ -439,12 +439,15 @@ int unit_find_paths(
         /**
          * Finds where the unit is defined on disk. Returns 0 if the unit is not found. Returns 1 if it is
          * found, and sets:
+         *
          * - the path to the unit in *ret_frament_path, if it exists on disk,
+         *
          * - and a strv of existing drop-ins in *ret_dropin_paths, if the arg is not NULL and any dropins
          *   were found.
          *
          * Returns -ERFKILL if the unit is masked, and -EKEYREJECTED if the unit file could not be loaded for
-         * some reason (the latter only applies if we are going through the service manager).
+         * some reason (the latter only applies if we are going through the service manager). As special
+         * exception it won't log for these two error cases.
          */
 
         assert(unit_name);
@@ -474,13 +477,13 @@ int unit_find_paths(
                         return log_error_errno(r, "Failed to get LoadState: %s", bus_error_message(&error, r));
 
                 if (streq(load_state, "masked"))
-                        return -ERFKILL;
+                        return -ERFKILL; /* special case: no logging */
                 if (streq(load_state, "not-found")) {
                         r = 0;
                         goto finish;
                 }
                 if (!STR_IN_SET(load_state, "loaded", "bad-setting"))
-                        return -EKEYREJECTED;
+                        return -EKEYREJECTED; /* special case: no logging */
 
                 r = sd_bus_get_property_string(
                                 bus,