From 398ef8ba0266cca453d90a90b3a2aa1caa44189f Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 8 Jul 2010 02:43:18 +0200 Subject: dbus: make errors reported via D-Bus more useful --- src/timer.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/timer.c') diff --git a/src/timer.c b/src/timer.c index b4521e6efc..1c7010d120 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,23 @@ fail: } static void timer_enter_running(Timer *t) { + DBusError error; int r; + assert(t); + dbus_error_init(&error); - 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) { -- cgit v1.2.3-54-g00ecf