chiark / gitweb /
main: disable nscd if we can to avoid deadlock, just in case
[elogind.git] / src / timer.c
index b4521e6efc9b5acd57648e2912dfdbeffcd40732..0d4ed27bb4f325274cb532db75eb300ab94b983d 100644 (file)
@@ -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) {