From: Lennart Poettering Date: Tue, 28 Apr 2020 16:16:47 +0000 (+0200) Subject: resolved: port to stat_inode_unmodified() X-Git-Tag: v246-rc1~348^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=61c12865f5653e34521d3bbf7c667cd4ea5f7385;p=thirdparty%2Fsystemd.git resolved: port to stat_inode_unmodified() --- diff --git a/src/resolve/resolved-manager.h b/src/resolve/resolved-manager.h index cbad1dce605..cbaef5e49c6 100644 --- a/src/resolve/resolved-manager.h +++ b/src/resolve/resolved-manager.h @@ -1,6 +1,8 @@ /* SPDX-License-Identifier: LGPL-2.1+ */ #pragma once +#include + #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; diff --git a/src/resolve/resolved-resolv-conf.c b/src/resolve/resolved-resolv-conf.c index c06213f4867..97aee7abc81 100644 --- a/src/resolve/resolved-resolv-conf.c +++ b/src/resolve/resolved-resolv-conf.c @@ -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