1 /*-*- Mode: C; c-basic-offset: 8 -*-*/
7 #include "load-dropin.h"
10 int unit_load_dropin(Unit *u) {
17 /* Load dependencies from supplementary drop-in directories */
19 SET_FOREACH(t, u->meta.names, i) {
24 if (asprintf(&path, "%s/%s.wants", unit_path(), t) < 0)
27 if (!(d = opendir(path))) {
39 while ((de = readdir(d))) {
40 if (de->d_name[0] == '.')
43 assert(de->d_name[0]);
45 if (de->d_name[strlen(de->d_name)-1] == '~')
48 if (asprintf(&path, "%s/%s.wants/%s", unit_path(), t, de->d_name) < 0) {
53 if (!unit_name_is_valid(de->d_name)) {
54 log_info("Name of %s is not a valid unit name. Ignoring.", path);
59 r = unit_add_dependency_by_name(u, UNIT_WANTS, path);