summaryrefslogtreecommitdiffstats
path: root/src/core/unit.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2022-11-15 19:18:30 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2022-12-06 09:49:31 +0100
commit1d0c81a05b1605a5fc3db44d5a157a1d6876eda9 (patch)
treeec92a3774d6cf6ed515656bf1dc833fc58b359f9 /src/core/unit.c
parenttest: add test case for sysv-generator and invalid dependency (diff)
downloadsystemd-1d0c81a05b1605a5fc3db44d5a157a1d6876eda9.tar.xz
systemd-1d0c81a05b1605a5fc3db44d5a157a1d6876eda9.zip
core/unit: merge unit names after merging deps
Before: systemd[1]: issue-24990.service: Dependency Before=n/a dropped, merged into issue-24990.service After: systemd[1]: issue-24990.service: Dependency Before=test1.service dropped, merged into issue-24990.service
Diffstat (limited to '')
-rw-r--r--src/core/unit.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/core/unit.c b/src/core/unit.c
index 0d52e4bf1a..ea09416be5 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -1165,11 +1165,6 @@ int unit_merge(Unit *u, Unit *other) {
if (r < 0)
return r;
- /* Merge names */
- r = unit_merge_names(u, other);
- if (r < 0)
- return r;
-
/* Redirect all references */
while (other->refs_by_target)
unit_ref_set(other->refs_by_target, other->refs_by_target->source, u);
@@ -1177,6 +1172,11 @@ int unit_merge(Unit *u, Unit *other) {
/* Merge dependencies */
unit_merge_dependencies(u, other);
+ /* Merge names. It is better to do that after merging deps, otherwise the log message contains n/a. */
+ r = unit_merge_names(u, other);
+ if (r < 0)
+ return r;
+
other->load_state = UNIT_MERGED;
other->merged_into = u;