]> err.no Git - systemd/commitdiff
make use of unit_add_dependency_by_name() where applicable
authorLennart Poettering <lennart@poettering.net>
Thu, 28 Jan 2010 05:43:49 +0000 (06:43 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 28 Jan 2010 05:43:49 +0000 (06:43 +0100)
load-dropin.c
load-fragment.c

index a57bfc455be3d45b5a30f5b9e0c3b08ec214271b..521eb0821aea9c84128003b3bb4444f20c18e4ca 100644 (file)
@@ -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);
index 0db74b3eeeb7c7725339631b2073683543357392..1a334bbc13a5cfe543e646f5cdcb5c031e77851b 100644 (file)
@@ -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;