mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-03-10 00:58:20 +03:00
make use of unit_add_dependency_by_name() where applicable
This commit is contained in:
parent
09b6b09f44
commit
b19e7dc010
@ -37,8 +37,6 @@ int unit_load_dropin(Unit *u) {
|
||||
free(path);
|
||||
|
||||
while ((de = readdir(d))) {
|
||||
Unit *other;
|
||||
|
||||
if (de->d_name[0] == '.')
|
||||
continue;
|
||||
|
||||
@ -58,18 +56,13 @@ int unit_load_dropin(Unit *u) {
|
||||
continue;
|
||||
}
|
||||
|
||||
r = manager_load_unit(u->meta.manager, path, &other);
|
||||
r = unit_add_dependency_by_name(u, UNIT_WANTS, path);
|
||||
free(path);
|
||||
|
||||
if (r < 0) {
|
||||
closedir(d);
|
||||
return r;
|
||||
}
|
||||
|
||||
if ((r = unit_add_dependency(u, UNIT_WANTS, other)) < 0) {
|
||||
closedir(d);
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
closedir(d);
|
||||
|
@ -35,19 +35,15 @@ static int config_parse_deps(
|
||||
FOREACH_WORD(w, &l, rvalue, state) {
|
||||
char *t;
|
||||
int r;
|
||||
Unit *other;
|
||||
|
||||
if (!(t = strndup(w, l)))
|
||||
return -ENOMEM;
|
||||
|
||||
r = manager_load_unit(u->meta.manager, t, &other);
|
||||
r = unit_add_dependency_by_name(u, d, t);
|
||||
free(t);
|
||||
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if ((r = unit_add_dependency(u, d, other)) < 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user