From: Peter Krempa Date: Wed, 5 Oct 2022 12:16:46 +0000 (+0200) Subject: virQEMUCapsLoadCache: Use 'virXMLPropUInt' instead of 'virXPathULong' X-Git-Tag: v8.10.0-rc1~236 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a3c7426839df25f4026707c5877be75f2461f5e9;p=thirdparty%2Flibvirt.git virQEMUCapsLoadCache: Use 'virXMLPropUInt' instead of 'virXPathULong' 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 --- 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() ||