summaryrefslogtreecommitdiff
path: root/src/target.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-07-16 03:17:34 +0200
committerLennart Poettering <lennart@poettering.net>2010-07-16 03:17:34 +0200
commit772a599e4f118fd166d83e7476ed867decefba70 (patch)
tree368dde8fdbe8f9bd6851790440f50c75e918473d /src/target.c
parentad780f1991d81c8013cc345488b9a035bf30aae7 (diff)
target: if the user configured a manual ordering between target units and the unit they require don't contradict that automatically
Diffstat (limited to 'src/target.c')
-rw-r--r--src/target.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/target.c b/src/target.c
index f8df6fb757..778cc6e0f1 100644
--- a/src/target.c
+++ b/src/target.c
@@ -55,18 +55,23 @@ static int target_add_default_dependencies(Target *t) {
Unit *other;
int r;
- /* Imply ordering for requirement dependencies
- * on target units. */
+ /* Imply ordering for requirement dependencies on target
+ * units. Note that when the user created a contradicting
+ * ordering manually we won't add anything in here to make
+ * sure we don't create a loop. */
SET_FOREACH(other, t->meta.dependencies[UNIT_REQUIRES], i)
- if ((r = unit_add_dependency(UNIT(t), UNIT_AFTER, other, true)) < 0)
- return r;
+ if (!set_get(t->meta.dependencies[UNIT_BEFORE], other))
+ if ((r = unit_add_dependency(UNIT(t), UNIT_AFTER, other, true)) < 0)
+ return r;
SET_FOREACH(other, t->meta.dependencies[UNIT_REQUIRES_OVERRIDABLE], i)
- if ((r = unit_add_dependency(UNIT(t), UNIT_AFTER, other, true)) < 0)
- return r;
+ if (!set_get(t->meta.dependencies[UNIT_BEFORE], other))
+ if ((r = unit_add_dependency(UNIT(t), UNIT_AFTER, other, true)) < 0)
+ return r;
SET_FOREACH(other, t->meta.dependencies[UNIT_WANTS], i)
- if ((r = unit_add_dependency(UNIT(t), UNIT_AFTER, other, true)) < 0)
- return r;
+ if (!set_get(t->meta.dependencies[UNIT_BEFORE], other))
+ if ((r = unit_add_dependency(UNIT(t), UNIT_AFTER, other, true)) < 0)
+ return r;
return 0;
}