X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Ftimer.c;h=2c21b49197978e41418463d5b327ac182e43f403;hp=1580478949595cd0a6006fd0360ad8103d497efc;hb=41b02ec77e54871eaa593c50fb31809814f627a7;hpb=6c155fe3d0634f636e76188b378da174ba02ef52 diff --git a/src/timer.c b/src/timer.c index 158047894..2c21b4919 100644 --- a/src/timer.c +++ b/src/timer.c @@ -82,7 +82,7 @@ static int timer_add_default_dependencies(Timer *t) { 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_CONFLICTS, SPECIAL_SHUTDOWN_TARGET, NULL, true); + return unit_add_two_dependencies_by_name(UNIT(t), UNIT_BEFORE, UNIT_CONFLICTED_BY, SPECIAL_SHUTDOWN_TARGET, NULL, true); } static int timer_load(Unit *u) { @@ -450,6 +450,17 @@ fail: log_error("Failed find timer unit: %s", strerror(-r)); } +static void timer_reset_maintenance(Unit *u) { + Timer *t = TIMER(u); + + assert(t); + + if (t->state == TIMER_MAINTENANCE) + timer_set_state(t, TIMER_DEAD); + + t->failure = false; +} + static const char* const timer_state_table[_TIMER_STATE_MAX] = { [TIMER_DEAD] = "dead", [TIMER_WAITING] = "waiting", @@ -492,5 +503,7 @@ const UnitVTable timer_vtable = { .timer_event = timer_timer_event, + .reset_maintenance = timer_reset_maintenance, + .bus_message_handler = bus_timer_message_handler };