[PATCH] cpu_conf: unbreak XPath in virCPUDefParseXML()

Daniel P. Berrangé berrange at redhat.com
Wed Feb 9 09:39:40 UTC 2022


On Tue, Feb 08, 2022 at 12:22:36PM +0100, Michal Privoznik wrote:
> In one of my previous commits, I've changed an XPath in
> virCPUDefParseXML() from "boolean(./counter...)" to
> "./counter...)". Notice the dangling closing bracket? Well, I
> didn't back then.

Suggests we have missing test XML data file example to
be added somewhere, as detecting parsing errors are the
one thing we are pretty good at in unit tests usually.

> 
> Fixes: 0fe2d8dd335054fae38b46bbbac58a4662e1a1d0
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/conf/cpu_conf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
> index da83e99371..819efcea8c 100644
> --- a/src/conf/cpu_conf.c
> +++ b/src/conf/cpu_conf.c
> @@ -441,7 +441,7 @@ virCPUDefParseXML(xmlXPathContextPtr ctxt,
>              return -1;
>          }
>  
> -        if ((counter_node = virXPathNode("./counter[@name='tsc'])", ctxt))) {
> +        if ((counter_node = virXPathNode("./counter[@name='tsc']", ctxt))) {
>              tsc = g_new0(virHostCPUTscInfo, 1);
>  
>              if (virXMLPropULongLong(counter_node, "frequency", 10,
> -- 
> 2.34.1
> 

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list