summaryrefslogtreecommitdiff
path: root/src/timesync/timesyncd.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-05-06 12:34:03 +0200
committerLennart Poettering <lennart@poettering.net>2014-05-06 12:34:37 +0200
commit600809211ecf1b1c3f2b701f30e5f77e33f0348b (patch)
tree7497dff569df7f31fd85a84d8d1197ff7a73f03a /src/timesync/timesyncd.c
parent1df52dd282cd6014ace8ca2279dd90d9ea52d2a4 (diff)
timesyncd: keep order of NTP servers
Diffstat (limited to 'src/timesync/timesyncd.c')
-rw-r--r--src/timesync/timesyncd.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/timesync/timesyncd.c b/src/timesync/timesyncd.c
index 1237abb542..1c0f113778 100644
--- a/src/timesync/timesyncd.c
+++ b/src/timesync/timesyncd.c
@@ -935,7 +935,7 @@ static int manager_connect(Manager *m) {
}
static int manager_add_server(Manager *m, const char *server) {
- ServerName *n;
+ ServerName *n, *tail;
assert(m);
assert(server);
@@ -950,7 +950,12 @@ static int manager_add_server(Manager *m, const char *server) {
return -ENOMEM;
}
- LIST_PREPEND(names, m->servers, n);
+ 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);
+
return 0;
}