summaryrefslogtreecommitdiff
path: root/src/unit.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-03-09 23:58:17 +0100
committerLennart Poettering <lennart@poettering.net>2011-03-09 23:58:17 +0100
commit90bbc9469ec29b6094dadf27aa88743d44ab56e7 (patch)
tree91333a8f42987224f2d7e837d60c15d93a689eff /src/unit.c
parentb925e72633bf98438f56a140520e07ec8c959e46 (diff)
condition: take a timestamp and store last result of conditions
Diffstat (limited to 'src/unit.c')
-rw-r--r--src/unit.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/unit.c b/src/unit.c
index 450b190c0e..117af4df44 100644
--- a/src/unit.c
+++ b/src/unit.c
@@ -825,6 +825,15 @@ fail:
return r;
}
+bool unit_condition_test(Unit *u) {
+ assert(u);
+
+ dual_timestamp_get(&u->meta.condition_timestamp);
+ u->meta.condition_result = condition_test_list(u->meta.conditions);
+
+ return u->meta.condition_result;
+}
+
/* Errors:
* -EBADR: This unit type does not support starting.
* -EALREADY: Unit is already started.
@@ -849,7 +858,7 @@ int unit_start(Unit *u) {
return -EALREADY;
/* If the conditions failed, don't do anything at all */
- if (!condition_test_list(u->meta.conditions)) {
+ if (!unit_condition_test(u)) {
log_debug("Starting of %s requested but condition failed. Ignoring.", u->meta.id);
return -EALREADY;
}