core: unify code for checking whether unit to trigger is loaded

This commit is contained in:
Lennart Poettering
2019-03-18 16:06:36 +01:00
parent 97a3f4ee05
commit a4191c9fb5
5 changed files with 26 additions and 18 deletions
+3 -6
View File
@@ -595,17 +595,14 @@ fail:
static int timer_start(Unit *u) {
Timer *t = TIMER(u);
TimerValue *v;
Unit *trigger;
int r;
assert(t);
assert(IN_SET(t->state, TIMER_DEAD, TIMER_FAILED));
trigger = UNIT_TRIGGER(u);
if (!trigger || trigger->load_state != UNIT_LOADED) {
log_unit_error(u, "Refusing to start, unit to trigger not loaded.");
return -ENOENT;
}
r = unit_test_trigger_loaded(u);
if (r < 0)
return r;
r = unit_test_start_limit(u);
if (r < 0) {