mirror of
https://github.com/systemd/systemd.git
synced 2024-12-22 17:35:35 +03:00
core: do not add dependencies to self
Adds a pair of files which cause a segfault (also with systemd-analyze verify). https://bugzilla.redhat.com/show_bug.cgi?id=1124843
This commit is contained in:
parent
17a6dfa3be
commit
e66047ff62
@ -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) {
|
||||
|
@ -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]);
|
||||
|
2
test/loopy.service
Normal file
2
test/loopy.service
Normal file
@ -0,0 +1,2 @@
|
||||
[Service]
|
||||
ExecStart=/bin/true
|
5
test/loopy.service.d/compat.conf
Normal file
5
test/loopy.service.d/compat.conf
Normal file
@ -0,0 +1,5 @@
|
||||
[Unit]
|
||||
BindsTo=loopy2.service
|
||||
|
||||
[Install]
|
||||
Also=loopy2.service
|
1
test/loopy2.service
Symbolic link
1
test/loopy2.service
Symbolic link
@ -0,0 +1 @@
|
||||
loopy.service
|
Loading…
Reference in New Issue
Block a user