chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
unit: properly update references to units which are merged
[elogind.git]
/
src
/
load-dropin.c
diff --git
a/src/load-dropin.c
b/src/load-dropin.c
index dbdc6a41df9a35ab09d133721cf60c23296e0d56..d114faa41f5ee38c5c222f9e49056a4306887347 100644
(file)
--- a/
src/load-dropin.c
+++ b/
src/load-dropin.c
@@
-36,7
+36,8
@@
static int iterate_dir(Unit *u, const char *path, UnitDependency dependency) {
assert(u);
assert(path);
assert(u);
assert(path);
- if (!(d = opendir(path))) {
+ d = opendir(path);
+ if (!d) {
if (errno == ENOENT)
return 0;
if (errno == ENOENT)
return 0;
@@
-60,7
+61,7
@@
static int iterate_dir(Unit *u, const char *path, UnitDependency dependency) {
free(f);
if (r < 0)
free(f);
if (r < 0)
-
goto finish
;
+
log_error("Cannot add dependency %s to %s, ignoring: %s", de->d_name, u->meta.id, strerror(-r))
;
}
r = 0;
}
r = 0;
@@
-97,13
+98,14
@@
static int process_dir(Unit *u, const char *unit_path, const char *name, const c
char *template;
/* Also try the template dir */
char *template;
/* Also try the template dir */
- if (!(template = unit_name_template(name)))
+ template = unit_name_template(name);
+ if (!template)
return -ENOMEM;
return -ENOMEM;
-
r = asprintf(&path, "%s/%s%s", unit_path, template, suffix
);
+
path = join(unit_path, "/", template, suffix, NULL
);
free(template);
free(template);
- if (
r < 0
)
+ if (
!path
)
return -ENOMEM;
if (u->meta.manager->unit_path_cache &&
return -ENOMEM;
if (u->meta.manager->unit_path_cache &&
@@
-134,10
+136,12
@@
int unit_load_dropin(Unit *u) {
STRV_FOREACH(p, u->meta.manager->lookup_paths.unit_path) {
int r;
STRV_FOREACH(p, u->meta.manager->lookup_paths.unit_path) {
int r;
- if ((r = process_dir(u, *p, t, ".wants", UNIT_WANTS)) < 0)
+ r = process_dir(u, *p, t, ".wants", UNIT_WANTS);
+ if (r < 0)
return r;
return r;
- if ((r = process_dir(u, *p, t, ".requires", UNIT_REQUIRES)) < 0)
+ r = process_dir(u, *p, t, ".requires", UNIT_REQUIRES);
+ if (r < 0)
return r;
}
}
return r;
}
}