1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-06 08:26:52 +03:00

timesyncd: make sure to reread /etc/resolv.conf when we try the next NTP server

This commit is contained in:
Lennart Poettering 2014-05-06 12:33:43 +02:00
parent 136aa3b444
commit 05f7fc0fe3

View File

@ -32,6 +32,7 @@
#include <sys/timerfd.h> #include <sys/timerfd.h>
#include <sys/timex.h> #include <sys/timex.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <resolv.h>
#include "missing.h" #include "missing.h"
#include "util.h" #include "util.h"
@ -913,6 +914,10 @@ static int manager_connect(Manager *m) {
m->current_server_name = m->servers; 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); r = sd_resolve_getaddrinfo(m->resolve, &m->resolve_query, m->current_server_name->string, "123", &hints, manager_resolve_handler, m);
if (r < 0) { if (r < 0) {
log_error("Failed to create resolver: %s", strerror(-r)); log_error("Failed to create resolver: %s", strerror(-r));