[libvirt PATCH 2/2] util: Stop storing dnsmasq version

Andrea Bolognani abologna at redhat.com
Mon Jan 17 16:40:02 UTC 2022


We don't do anything with it after checking that it satisfies our
requirements and don't provide a way for users of the module to
access it, so carrying it around is pointless.

Signed-off-by: Andrea Bolognani <abologna at redhat.com>
---
 src/util/virdnsmasq.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/util/virdnsmasq.c b/src/util/virdnsmasq.c
index 57b24c9f6a..b5f903cfac 100644
--- a/src/util/virdnsmasq.c
+++ b/src/util/virdnsmasq.c
@@ -577,7 +577,6 @@ dnsmasqReload(pid_t pid G_GNUC_UNUSED)
 struct _dnsmasqCaps {
     virObject parent;
     char *binaryPath;
-    unsigned long version;
 };
 
 static virClass *dnsmasqCapsClass;
@@ -608,6 +607,7 @@ dnsmasqCapsSetFromBuffer(dnsmasqCaps *caps, const char *buf)
 {
     int len;
     const char *p;
+    unsigned long version;
 
     p = STRSKIP(buf, DNSMASQ_VERSION_STR);
     if (!p)
@@ -615,21 +615,21 @@ dnsmasqCapsSetFromBuffer(dnsmasqCaps *caps, const char *buf)
 
     virSkipToDigit(&p);
 
-    if (virParseVersionString(p, &caps->version, true) < 0)
+    if (virParseVersionString(p, &version, true) < 0)
         goto error;
 
-    if (caps->version < DNSMASQ_MIN_MAJOR * 1000000 + DNSMASQ_MIN_MINOR * 1000) {
+    if (version < DNSMASQ_MIN_MAJOR * 1000000 + DNSMASQ_MIN_MINOR * 1000) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("dnsmasq version >= %u.%u required but %lu.%lu found"),
                        DNSMASQ_MIN_MAJOR, DNSMASQ_MIN_MINOR,
-                       caps->version / 1000000,
-                       caps->version % 1000000 / 1000);
+                       version / 1000000,
+                       version % 1000000 / 1000);
         goto error;
     }
 
     VIR_INFO("dnsmasq version is %d.%d",
-             (int)caps->version / 1000000,
-             (int)(caps->version % 1000000) / 1000);
+             (int)version / 1000000,
+             (int)(version % 1000000) / 1000);
     return 0;
 
  error:
-- 
2.34.1




More information about the libvir-list mailing list