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
@ -597,6 +597,10 @@ static void merge_dependencies(Unit *u, Unit *other, UnitDependency d) {
|
||||
UnitDependency k;
|
||||
|
||||
for (k = 0; k < _UNIT_DEPENDENCY_MAX; k++) {
|
||||
/* Do not add dependencies between u and itself */
|
||||
if (back == u) {
|
||||
set_remove(back->dependencies[k], other);
|
||||
} else {
|
||||
r = set_remove_and_put(back->dependencies[k], other, u);
|
||||
if (r == -EEXIST)
|
||||
set_remove(back->dependencies[k], other);
|
||||
@ -604,6 +608,10 @@ static void merge_dependencies(Unit *u, Unit *other, UnitDependency d) {
|
||||
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]);
|
||||
|
||||
|
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