X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Ftimer.c;h=6f1f02ddbc65a62312c19f34771db72d9a985ee0;hb=ec14911e0d6b9473f4f1d6b43d7fcd67c48c2ffc;hp=b01944ccdbd34ae81322c74c66977280f91fb00a;hpb=10717a1a8d48e50463abf2f6b47e2618eaa529e7;p=elogind.git diff --git a/src/timer.c b/src/timer.c index b01944ccd..6f1f02ddb 100644 --- a/src/timer.c +++ b/src/timer.c @@ -78,11 +78,15 @@ static int timer_add_default_dependencies(Timer *t) { assert(t); - if (t->meta.manager->running_as == MANAGER_SYSTEM) + if (t->meta.manager->running_as == MANAGER_SYSTEM) { + if ((r = unit_add_dependency_by_name(UNIT(t), UNIT_BEFORE, SPECIAL_BASIC_TARGET, NULL, true)) < 0) + return r; + if ((r = unit_add_two_dependencies_by_name(UNIT(t), UNIT_AFTER, UNIT_REQUIRES, SPECIAL_SYSINIT_TARGET, NULL, true)) < 0) return r; + } - return unit_add_two_dependencies_by_name(UNIT(t), UNIT_BEFORE, UNIT_CONFLICTED_BY, SPECIAL_SHUTDOWN_TARGET, NULL, true); + return unit_add_two_dependencies_by_name(UNIT(t), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_SHUTDOWN_TARGET, NULL, true); } static int timer_load(Unit *u) { @@ -161,9 +165,7 @@ static int timer_coldplug(Unit *u) { if (t->deserialized_state != t->state) { - if (t->deserialized_state == TIMER_WAITING || - t->deserialized_state == TIMER_RUNNING || - t->deserialized_state == TIMER_ELAPSED) + if (t->deserialized_state == TIMER_WAITING) timer_enter_waiting(t, false); else timer_set_state(t, t->deserialized_state);