summaryrefslogtreecommitdiff
path: root/src/core/timer.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-05-13 18:30:14 +0200
committerLennart Poettering <lennart@poettering.net>2015-05-13 18:30:14 +0200
commitcbf60d0a7fda7bd6c0578a6cc151f798a0edfd02 (patch)
tree2dfa9ac6f8f0501354c4d9a272dc49dc91357e4c /src/core/timer.c
parentb4a855e9f6a4d09c18772aa797dc7d606d163b88 (diff)
core: only set event source name when we create an event source
Diffstat (limited to 'src/core/timer.c')
-rw-r--r--src/core/timer.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/core/timer.c b/src/core/timer.c
index d427956e0c..7f4a2eb716 100644
--- a/src/core/timer.c
+++ b/src/core/timer.c
@@ -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) {