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
@@ -555,17 +555,14 @@ static void path_mkdir(Path *p) {
static int path_start(Unit *u) {
Path *p = PATH(u);
Unit *trigger;
int r;
assert(p);
assert(IN_SET(p->state, PATH_DEAD, PATH_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) {