diff options
-rw-r--r-- | src/core/load-dropin.c | 2 | ||||
-rw-r--r-- | src/core/unit.c | 16 | ||||
-rw-r--r-- | test/loopy.service | 2 | ||||
-rw-r--r-- | test/loopy.service.d/compat.conf | 5 | ||||
l--------- | test/loopy2.service | 1 |
5 files changed, 21 insertions, 5 deletions
diff --git a/src/core/load-dropin.c b/src/core/load-dropin.c index 21c991526c..ffc68b4d73 100644 --- a/src/core/load-dropin.c +++ b/src/core/load-dropin.c @@ -181,7 +181,7 @@ int unit_load_dropin(Unit *u) { } u->dropin_paths = unit_find_dropin_paths(u); - if (! u->dropin_paths) + if (!u->dropin_paths) return 0; STRV_FOREACH(f, u->dropin_paths) { diff --git a/src/core/unit.c b/src/core/unit.c index b68796a941..092673256d 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -597,14 +597,22 @@ static void merge_dependencies(Unit *u, Unit *other, UnitDependency d) { UnitDependency k; for (k = 0; k < _UNIT_DEPENDENCY_MAX; k++) { - r = set_remove_and_put(back->dependencies[k], other, u); - if (r == -EEXIST) + /* Do not add dependencies between u and itself */ + if (back == u) { set_remove(back->dependencies[k], other); - else - assert(r >= 0 || r == -ENOENT); + } else { + r = set_remove_and_put(back->dependencies[k], other, u); + if (r == -EEXIST) + set_remove(back->dependencies[k], other); + else + assert(r >= 0 || r == -ENOENT); + } } } + /* Also do not move dependencies on u to itself */ + set_remove(other->dependencies[d], u); + complete_move(&u->dependencies[d], &other->dependencies[d]); set_free(other->dependencies[d]); diff --git a/test/loopy.service b/test/loopy.service new file mode 100644 index 0000000000..9eb645748e --- /dev/null +++ b/test/loopy.service @@ -0,0 +1,2 @@ +[Service] +ExecStart=/bin/true diff --git a/test/loopy.service.d/compat.conf b/test/loopy.service.d/compat.conf new file mode 100644 index 0000000000..51b84b89ed --- /dev/null +++ b/test/loopy.service.d/compat.conf @@ -0,0 +1,5 @@ +[Unit] +BindsTo=loopy2.service + +[Install] +Also=loopy2.service diff --git a/test/loopy2.service b/test/loopy2.service new file mode 120000 index 0000000000..961b1fe9bc --- /dev/null +++ b/test/loopy2.service @@ -0,0 +1 @@ +loopy.service
\ No newline at end of file |