1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-06 16:59:03 +03:00

core: don't drop transient drop-ins when loading the rest

Previously, when creating a transient unit, we'd first add the transient
drop-ins to the unit, and then normally load any other drop-ins later on top of
this, replacing the already loaded drop-ins. Let's not do this, after all the
transient drop-ins area already in effect, let's just add what we find on disk,
but not replace it.
This commit is contained in:
Lennart Poettering 2016-02-26 17:05:33 +01:00
parent a145334304
commit d7e0da1db2

View File

@ -44,6 +44,7 @@ static int add_dependency_consumer(
} }
int unit_load_dropin(Unit *u) { int unit_load_dropin(Unit *u) {
_cleanup_strv_free_ char **l = NULL;
Iterator i; Iterator i;
char *t, **f; char *t, **f;
int r; int r;
@ -63,11 +64,19 @@ int unit_load_dropin(Unit *u) {
} }
} }
u->dropin_paths = strv_free(u->dropin_paths); r = unit_find_dropin_paths(u, &l);
r = unit_find_dropin_paths(u, &u->dropin_paths);
if (r <= 0) if (r <= 0)
return 0; return 0;
if (!u->dropin_paths) {
u->dropin_paths = l;
l = NULL;
} else {
r = strv_extend_strv(&u->dropin_paths, l, true);
if (r < 0)
return log_oom();
}
STRV_FOREACH(f, u->dropin_paths) { STRV_FOREACH(f, u->dropin_paths) {
config_parse(u->id, *f, NULL, config_parse(u->id, *f, NULL,
UNIT_VTABLE(u)->sections, UNIT_VTABLE(u)->sections,