core: only set event source name when we create an event source

This commit is contained in:
Lennart Poettering
2015-05-13 18:30:14 +02:00
parent b4a855e9f6
commit cbf60d0a7f
4 changed files with 36 additions and 24 deletions
+15 -8
View File
@@ -429,17 +429,21 @@ static void timer_enter_waiting(Timer *t, bool initial) {
goto fail;
r = sd_event_source_set_enabled(t->monotonic_event_source, SD_EVENT_ONESHOT);
} else
if (r < 0)
goto fail;
} else {
r = sd_event_add_time(
UNIT(t)->manager->event,
&t->monotonic_event_source,
t->wake_system ? CLOCK_BOOTTIME_ALARM : CLOCK_MONOTONIC,
t->next_elapse_monotonic_or_boottime, t->accuracy_usec,
timer_dispatch, t);
if (r < 0)
goto fail;
if (r < 0)
goto fail;
(void) sd_event_source_set_description(t->monotonic_event_source, "timer-monotonic");
(void) sd_event_source_set_description(t->monotonic_event_source, "timer-monotonic");
}
} else if (t->monotonic_event_source) {
@@ -458,17 +462,20 @@ static void timer_enter_waiting(Timer *t, bool initial) {
goto fail;
r = sd_event_source_set_enabled(t->realtime_event_source, SD_EVENT_ONESHOT);
} else
if (r < 0)
goto fail;
} else {
r = sd_event_add_time(
UNIT(t)->manager->event,
&t->realtime_event_source,
t->wake_system ? CLOCK_REALTIME_ALARM : CLOCK_REALTIME,
t->next_elapse_realtime, t->accuracy_usec,
timer_dispatch, t);
if (r < 0)
goto fail;
if (r < 0)
goto fail;
(void) sd_event_source_set_description(t->realtime_event_source, "timer-realtime");
(void) sd_event_source_set_description(t->realtime_event_source, "timer-realtime");
}
} else if (t->realtime_event_source) {