resolved: port to stat_inode_unmodified()

This commit is contained in:
Lennart Poettering
2020-05-13 16:57:44 +02:00
parent fee5c52ac2
commit 61c12865f5
2 changed files with 6 additions and 3 deletions
+3 -1
View File
@@ -1,6 +1,8 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
#include <sys/stat.h>
#include "sd-event.h"
#include "sd-netlink.h"
#include "sd-network.h"
@@ -71,7 +73,7 @@ struct Manager {
bool need_builtin_fallbacks:1;
bool read_resolv_conf:1;
usec_t resolv_conf_mtime;
struct stat resolv_conf_stat;
DnsTrustAnchor trust_anchor;
+3 -2
View File
@@ -14,6 +14,7 @@
#include "resolved-conf.h"
#include "resolved-dns-server.h"
#include "resolved-resolv-conf.h"
#include "stat-util.h"
#include "string-util.h"
#include "strv.h"
#include "tmpfile-util-label.h"
@@ -93,7 +94,7 @@ int manager_read_resolv_conf(Manager *m) {
}
/* Have we already seen the file? */
if (timespec_load(&st.st_mtim) == m->resolv_conf_mtime)
if (stat_inode_unmodified(&st, &m->resolv_conf_stat))
return 0;
if (file_is_our_own(&st))
@@ -159,7 +160,7 @@ int manager_read_resolv_conf(Manager *m) {
log_syntax(NULL, LOG_DEBUG, "/etc/resolv.conf", n, 0, "Ignoring resolv.conf line: %s", l);
}
m->resolv_conf_mtime = timespec_load(&st.st_mtim);
m->resolv_conf_stat = st;
/* Flush out all servers and search domains that are still
* marked. Those are then ones that didn't appear in the new