core: unify code for checking whether unit to trigger is loaded
This commit is contained in:
+3
-6
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user