]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolved: port to stat_inode_unmodified()
authorLennart Poettering <lennart@poettering.net>
Tue, 28 Apr 2020 16:16:47 +0000 (18:16 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 13 May 2020 14:57:44 +0000 (16:57 +0200)
src/resolve/resolved-manager.h
src/resolve/resolved-resolv-conf.c

index cbad1dce6058df10cf3e7fb9d22416d784d67617..cbaef5e49c65f986b6530774c419df1ef094249f 100644 (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;
 
index c06213f4867fd2bed64e5a60436c926daea03ce7..97aee7abc816ba756e83bad37212c9bac92f02a4 100644 (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