summaryrefslogtreecommitdiff
path: root/src/core/path.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-11-11 20:42:39 +0100
committerLennart Poettering <lennart@poettering.net>2015-11-11 20:42:39 +0100
commit4c9ea260aeaff2e837f543e3c42d2e7102af1137 (patch)
treee1e6a1f6cbcb1a11c3eda17376e52fd401fcf8f9 /src/core/path.c
parent45f06b3450174a9649a51a0b48fdbbbe98f2bb5d (diff)
core: simplify things a bit by checking default_dependencies boolean in callee, not caller
It's nicer to hide the check away in the various xyz_add_default_dependencies() calls, rather than making it explicit in the caller, and thus require deeper nesing.
Diffstat (limited to 'src/core/path.c')
-rw-r--r--src/core/path.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/core/path.c b/src/core/path.c
index 35e1753583..c0992b4fcc 100644
--- a/src/core/path.c
+++ b/src/core/path.c
@@ -315,20 +315,20 @@ static int path_add_default_dependencies(Path *p) {
assert(p);
- r = unit_add_dependency_by_name(UNIT(p), UNIT_BEFORE,
- SPECIAL_PATHS_TARGET, NULL, true);
+ if (!UNIT(p)->default_dependencies)
+ return 0;
+
+ r = unit_add_dependency_by_name(UNIT(p), UNIT_BEFORE, SPECIAL_PATHS_TARGET, NULL, true);
if (r < 0)
return r;
if (UNIT(p)->manager->running_as == MANAGER_SYSTEM) {
- r = unit_add_two_dependencies_by_name(UNIT(p), UNIT_AFTER, UNIT_REQUIRES,
- SPECIAL_SYSINIT_TARGET, NULL, true);
+ r = unit_add_two_dependencies_by_name(UNIT(p), UNIT_AFTER, UNIT_REQUIRES, SPECIAL_SYSINIT_TARGET, NULL, true);
if (r < 0)
return r;
}
- return unit_add_two_dependencies_by_name(UNIT(p), UNIT_BEFORE, UNIT_CONFLICTS,
- SPECIAL_SHUTDOWN_TARGET, NULL, true);
+ return unit_add_two_dependencies_by_name(UNIT(p), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_SHUTDOWN_TARGET, NULL, true);
}
static int path_load(Unit *u) {
@@ -360,11 +360,9 @@ static int path_load(Unit *u) {
if (r < 0)
return r;
- if (UNIT(p)->default_dependencies) {
- r = path_add_default_dependencies(p);
- if (r < 0)
- return r;
- }
+ r = path_add_default_dependencies(p);
+ if (r < 0)
+ return r;
}
return path_verify(p);