加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-core-unit-merge-unit-names-after-merging-deps.patch 1.45 KB
一键复制 编辑 原始数据 按行查看 历史
hongjinghao 提交于 2023-03-22 14:48 . sync patches fromsystemd community
From 1d0c81a05b1605a5fc3db44d5a157a1d6876eda9 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Wed, 16 Nov 2022 03:18:30 +0900
Subject: [PATCH] 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
---
src/core/unit.c | 10 +++++-----
1 file 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;
--
2.27.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化