From: Lennart Poettering Date: Thu, 28 Jan 2010 05:43:49 +0000 (+0100) Subject: make use of unit_add_dependency_by_name() where applicable X-Git-Tag: 0.git+20100605+dfd8ee-1~366 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b19e7dc0104c8839835a90d7df20c2eeb631e07e;p=systemd make use of unit_add_dependency_by_name() where applicable --- diff --git a/load-dropin.c b/load-dropin.c index a57bfc45..521eb082 100644 --- a/load-dropin.c +++ b/load-dropin.c @@ -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); diff --git a/load-fragment.c b/load-fragment.c index 0db74b3e..1a334bbc 100644 --- a/load-fragment.c +++ b/load-fragment.c @@ -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;