]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
unit: move "not supported" check after condition check in unit_start() 1189/head
authorLennart Poettering <lennart@poettering.net>
Mon, 7 Sep 2015 12:08:24 +0000 (14:08 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 7 Sep 2015 12:10:53 +0000 (14:10 +0200)
Make sure we always check conditions before checking whether the unit
type is supported in unit_start(), since condition checks are "clean
errors", while "not supported" errors are fatal.

This cleans up the boot output of systemd in containers, where a lot of
NOTSUPP lines were shown befor this fix.

This partially reverts 8ff4d2ab0d4758e914aea6d86154d85f2b2c787f which
reorder the checks.

src/core/unit.c

index 45ce1b172df929213e2b024c531fc63093b2def5..1aa0321b23ff712de281d25aadf12035bb7cea08 100644 (file)
@@ -1420,10 +1420,6 @@ int unit_start(Unit *u) {
         if (u->load_state != UNIT_LOADED)
                 return -EINVAL;
 
-        /* Units of types that aren't supported annot be started either */
-        if (!unit_supported(u))
-                return -EOPNOTSUPP;
-
         /* If this is already started, then this will succeed. Note
          * that this will even succeed if this unit is not startable
          * by the user. This is relied on to detect when we need to
@@ -1449,6 +1445,15 @@ int unit_start(Unit *u) {
                 return -EPROTO;
         }
 
+        /* Units of types that aren't supported cannot be
+         * started. Note that we do this test only after the condition
+         * checks, so that we rather return condition check errors
+         * (which are usually not considered a true failure) than "not
+         * supported" errors (which are considered a failure).
+         */
+        if (!unit_supported(u))
+                return -EOPNOTSUPP;
+
         /* Forward to the main object, if we aren't it. */
         following = unit_following(u);
         if (following) {