chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sysv: properly enumerate rcN.d directory
[elogind.git]
/
load-dropin.c
diff --git
a/load-dropin.c
b/load-dropin.c
index 13d7bc8fe4cb5e2cbdbd19ae1b62d9c02753659b..a3c9d3c77dde42b5eb859494eff1bd7880220ad6 100644
(file)
--- a/
load-dropin.c
+++ b/
load-dropin.c
@@
-25,6
+25,7
@@
#include "unit.h"
#include "load-dropin.h"
#include "log.h"
#include "unit.h"
#include "load-dropin.h"
#include "log.h"
+#include "strv.h"
int unit_load_dropin(Unit *u) {
Iterator i;
int unit_load_dropin(Unit *u) {
Iterator i;
@@
-39,52
+40,52
@@
int unit_load_dropin(Unit *u) {
char *path;
DIR *d;
struct dirent *de;
char *path;
DIR *d;
struct dirent *de;
+ char **p;
- if (asprintf(&path, "%s/%s.wants", unit_path(), t) < 0)
- return -ENOMEM;
+ STRV_FOREACH(p, u->meta.manager->unit_path) {
- if (!(d = opendir(path))) {
- r = -errno;
- free(path);
+ if (asprintf(&path, "%s/%s.wants", *p, t) < 0)
+ return -ENOMEM;
- if (r == -ENOENT)
- continue;
+ if (!(d = opendir(path))) {
+ r = -errno;
+ free(path);
- return r;
- }
+ if (r == -ENOENT)
+ continue;
- free(path);
+ return r;
+ }
- while ((de = readdir(d))) {
- if (de->d_name[0] == '.')
- continue;
+ free(path);
- assert(de->d_name[0]);
+ while ((de = readdir(d))) {
-
if (de->d_name[strlen(de->d_name)-1] == '~'
)
- continue;
+
if (ignore_file(de->d_name)
)
+
continue;
-
if (asprintf(&path, "%s/%s.wants/%s", unit_path()
, t, de->d_name) < 0) {
- closedir(d);
- return -ENOMEM;
- }
+
if (asprintf(&path, "%s/%s.wants/%s", *p
, t, de->d_name) < 0) {
+
closedir(d);
+
return -ENOMEM;
+
}
- if (!unit_name_is_valid(de->d_name)) {
- log_info("Name of %s is not a valid unit name. Ignoring.", path);
- free(path);
- continue;
- }
+
if (!unit_name_is_valid(de->d_name)) {
+
log_info("Name of %s is not a valid unit name. Ignoring.", path);
+
free(path);
+
continue;
+
}
- r = unit_add_dependency_by_name(u, UNIT_WANTS, path);
- free(path);
+
r = unit_add_dependency_by_name(u, UNIT_WANTS, path);
+
free(path);
- if (r < 0) {
- closedir(d);
- return r;
+ if (r < 0) {
+ closedir(d);
+ return r;
+ }
}
}
- }
- closedir(d);
+ closedir(d);
+ }
}
return 0;
}
return 0;