diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-05-06 13:07:15 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-05-06 13:07:15 +0200 |
commit | 376cd3b89c62f580a6f576cecfbbb28d3944118f (patch) | |
tree | b3c38305268bf87703884743a3c04b302fbecb15 /src/timesync | |
parent | 2db3e2023d1af9eab6ebecddbf64812be2b104f5 (diff) |
list: make LIST_FIND_TAIL work for empty lists
Diffstat (limited to 'src/timesync')
-rw-r--r-- | src/timesync/timesyncd.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/timesync/timesyncd.c b/src/timesync/timesyncd.c index 1c0f113778..fa9671da1d 100644 --- a/src/timesync/timesyncd.c +++ b/src/timesync/timesyncd.c @@ -335,7 +335,7 @@ static int manager_clock_watch_setup(Manager *m) { assert(m); m->event_clock_watch = sd_event_source_unref(m->event_clock_watch); - m->clock_watch_fd = safe_close(m->clock_watch_fd); + safe_close(m->clock_watch_fd); m->clock_watch_fd = timerfd_create(CLOCK_REALTIME, TFD_NONBLOCK|TFD_CLOEXEC); if (m->clock_watch_fd < 0) { @@ -950,11 +950,8 @@ static int manager_add_server(Manager *m, const char *server) { return -ENOMEM; } - if (m->servers) { - LIST_FIND_TAIL(names, m->servers, tail); - LIST_INSERT_AFTER(names, m->servers, tail, n); - } else - LIST_PREPEND(names, m->servers, n); + LIST_FIND_TAIL(names, m->servers, tail); + LIST_INSERT_AFTER(names, m->servers, tail, n); return 0; } |