]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/unit: follow merged units before updating SourcePath= timestamp too
authorMike Yuan <me@yhndnzj.com>
Fri, 28 Jun 2024 13:32:33 +0000 (15:32 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Fri, 28 Jun 2024 19:10:16 +0000 (21:10 +0200)
Currently, we only follow merged units for unit_load_dropin() call.
But if the unit is an alias, we should always perform operations
on the "canonical" unit.

src/core/unit.c

index 0e931be484665549fdc5d61623c2f7216bc69845..32f28b286ba9719e1c6b8f6866c026840e48e9a8 100644 (file)
@@ -1402,11 +1402,13 @@ int unit_load_fragment_and_dropin(Unit *u, bool fragment_required) {
                 u->load_state = UNIT_LOADED;
         }
 
+        u = unit_follow_merge(u);
+
         /* Load drop-in directory data. If u is an alias, we might be reloading the
          * target unit needlessly. But we cannot be sure which drops-ins have already
          * been loaded and which not, at least without doing complicated book-keeping,
          * so let's always reread all drop-ins. */
-        r = unit_load_dropin(unit_follow_merge(u));
+        r = unit_load_dropin(u);
         if (r < 0)
                 return r;