[PATCH v4 04/13] virdnsmasq: Drop mtime member from struct _dnsmasqCaps

Michal Privoznik mprivozn at redhat.com
Mon Jan 17 15:19:18 UTC 2022


The _dnsmasqCaps struct has @mtime member which holds the mtime
of the dnsmasq binary. The idea was that capabilities don't need
to be queried if mtime hasn't changed since the last time.
However, the code that would try to query capabilities again was
removed and now we are left with code that stores mtime but has
no use for it.

Remove the member and code that uses it.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/util/virdnsmasq.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/src/util/virdnsmasq.c b/src/util/virdnsmasq.c
index 7fcaadda3f..c3801d622f 100644
--- a/src/util/virdnsmasq.c
+++ b/src/util/virdnsmasq.c
@@ -577,7 +577,6 @@ struct _dnsmasqCaps {
     virObject parent;
     char *binaryPath;
     bool noRefresh;
-    time_t mtime;
     unsigned long version;
 };
 
@@ -651,7 +650,6 @@ dnsmasqCapsSetFromBuffer(dnsmasqCaps *caps, const char *buf)
 static int
 dnsmasqCapsRefreshInternal(dnsmasqCaps *caps)
 {
-    struct stat sb;
     g_autoptr(virCommand) vercmd = NULL;
     g_autoptr(virCommand) helpcmd = NULL;
     g_autofree char *help = NULL;
@@ -661,15 +659,6 @@ dnsmasqCapsRefreshInternal(dnsmasqCaps *caps)
     if (!caps || caps->noRefresh)
         return 0;
 
-    if (stat(caps->binaryPath, &sb) < 0) {
-        virReportSystemError(errno, _("Cannot check dnsmasq binary %s"),
-                             caps->binaryPath);
-        return -1;
-    }
-    if (caps->mtime == sb.st_mtime)
-        return 0;
-    caps->mtime = sb.st_mtime;
-
     /* Make sure the binary we are about to try exec'ing exists.
      * Technically we could catch the exec() failure, but that's
      * in a sub-process so it's hard to feed back a useful error.
-- 
2.34.1




More information about the libvir-list mailing list