chiark / gitweb /
timesyncd: make sure to reread /etc/resolv.conf when we try the next NTP server
authorLennart Poettering <lennart@poettering.net>
Tue, 6 May 2014 10:33:43 +0000 (12:33 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 6 May 2014 10:34:37 +0000 (12:34 +0200)
src/timesync/timesyncd.c

index 33afbce..1237abb 100644 (file)
@@ -32,6 +32,7 @@
 #include <sys/timerfd.h>
 #include <sys/timex.h>
 #include <sys/socket.h>
+#include <resolv.h>
 
 #include "missing.h"
 #include "util.h"
@@ -913,6 +914,10 @@ static int manager_connect(Manager *m) {
                         m->current_server_name = m->servers;
                 }
 
+                /* Tell the resolver to reread /etc/resolv.conf, in
+                 * case it changed. */
+                res_init();
+
                 r = sd_resolve_getaddrinfo(m->resolve, &m->resolve_query, m->current_server_name->string, "123", &hints, manager_resolve_handler, m);
                 if (r < 0) {
                         log_error("Failed to create resolver: %s", strerror(-r));