X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Ftimer.c;h=0d4ed27bb4f325274cb532db75eb300ab94b983d;hp=b4521e6efc9b5acd57648e2912dfdbeffcd40732;hb=ad780f1991d81c8013cc345488b9a035bf30aae7;hpb=03fae01822b5275a2940458f65644796283a8a23 diff --git a/src/timer.c b/src/timer.c index b4521e6ef..0d4ed27bb 100644 --- a/src/timer.c +++ b/src/timer.c @@ -26,6 +26,7 @@ #include "timer.h" #include "dbus-timer.h" #include "special.h" +#include "bus-errors.h" static const UnitActiveState state_translation_table[_TIMER_STATE_MAX] = { [TIMER_DEAD] = UNIT_INACTIVE, @@ -261,18 +262,27 @@ fail: } static void timer_enter_running(Timer *t) { + DBusError error; int r; + assert(t); + dbus_error_init(&error); + + /* Don't start job if we are supposed to go down */ + if (t->meta.job && t->meta.job->type == JOB_STOP) + return; - if ((r = manager_add_job(t->meta.manager, JOB_START, t->unit, JOB_REPLACE, true, NULL)) < 0) + if ((r = manager_add_job(t->meta.manager, JOB_START, t->unit, JOB_REPLACE, true, &error, NULL)) < 0) goto fail; timer_set_state(t, TIMER_RUNNING); return; fail: - log_warning("%s failed to queue unit startup job: %s", t->meta.id, strerror(-r)); + log_warning("%s failed to queue unit startup job: %s", t->meta.id, bus_error(&error, r)); timer_enter_dead(t, false); + + dbus_error_free(&error); } static int timer_start(Unit *u) {