ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
ac3a84
From 1d12983063afc64709894d80b7adcf6609aa9a43 Mon Sep 17 00:00:00 2001
ac3a84
From: Yu Watanabe <watanabe.yu+github@gmail.com>
ac3a84
Date: Tue, 15 Nov 2022 23:08:35 +0900
ac3a84
Subject: [PATCH] core/unit: fix logic of dropping self-referencing
ac3a84
 dependencies
ac3a84
ac3a84
Fixes a bug in 15ed3c3a188cf7fa5a60ae508fc7a3ed048d2220.
ac3a84
ac3a84
(cherry picked from commit 53e0e6ef0eea396bb432cbfc1f2f6ea1272ff1f1)
ac3a84
ac3a84
Related: #2160477
ac3a84
---
ac3a84
 src/core/unit.c | 3 ++-
ac3a84
 1 file changed, 2 insertions(+), 1 deletion(-)
ac3a84
ac3a84
diff --git a/src/core/unit.c b/src/core/unit.c
ac3a84
index ae9f688ad2..dbbf818622 100644
ac3a84
--- a/src/core/unit.c
ac3a84
+++ b/src/core/unit.c
ac3a84
@@ -1130,10 +1130,11 @@ static void unit_merge_dependencies(Unit *u, Unit *other) {
ac3a84
                         }
ac3a84
                 } else {
ac3a84
                         assert_se(r >= 0);
ac3a84
-                        TAKE_PTR(other_deps);
ac3a84
 
ac3a84
                         if (hashmap_remove(other_deps, u))
ac3a84
                                 unit_maybe_warn_about_dependency(u, other->id, UNIT_DEPENDENCY_FROM_PTR(dt));
ac3a84
+
ac3a84
+                        TAKE_PTR(other_deps);
ac3a84
                 }
ac3a84
         }
ac3a84