From a3c7426839df25f4026707c5877be75f2461f5e9 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Wed, 5 Oct 2022 14:16:46 +0200 Subject: [PATCH] virQEMUCapsLoadCache: Use 'virXMLPropUInt' instead of 'virXPathULong' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The libvirt version is stored in an 'unsigned int' use the proper XPath query function for the type and remove the temporary variable. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- src/qemu/qemu_capabilities.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index dd50f85c73..63590f139f 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -4385,7 +4385,6 @@ virQEMUCapsLoadCache(virArch hostArch, g_autoptr(xmlDoc) doc = NULL; g_autoptr(xmlXPathContext) ctxt = NULL; long long int l; - unsigned long lu; if (!(doc = virXMLParse(filename, NULL, NULL, "qemuCaps", &ctxt, NULL, false))) return -1; @@ -4397,9 +4396,9 @@ virQEMUCapsLoadCache(virArch hostArch, } qemuCaps->libvirtCtime = (time_t)l; - qemuCaps->libvirtVersion = 0; - if (virXPathULong("string(./selfvers)", ctxt, &lu) == 0) - qemuCaps->libvirtVersion = lu; + if (virXMLPropUInt(ctxt->node, "selfvers", 10, VIR_XML_PROP_NONE, + &qemuCaps->libvirtVersion) < 0) + return -1; if (!skipInvalidation && (qemuCaps->libvirtCtime != virGetSelfLastChanged() ||