]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
testParseXMLDocFromFile: Validate that the replaced node is identical with parsed...
authorPeter Krempa <pkrempa@redhat.com>
Thu, 22 Sep 2022 14:41:25 +0000 (16:41 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 6 Oct 2022 08:54:24 +0000 (10:54 +0200)
When replacing a definition node by contents of a file the root node in
the file must match the replaced node.

Enforce that by passing the original node name as the 'rootnode'
argument of virXMLParse.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/test/test_driver.c

index 26c6c95c28ce974f4eb0aecabd309939a6815b37..5eae22f591897e752deab38ed72c187a01c029ad 100644 (file)
@@ -851,7 +851,8 @@ testParseXMLDocFromFile(xmlNodePtr node,
         g_autofree char *absFile = testBuildFilename(file, relFile);
         xmlNodePtr newnode = NULL;
 
-        if (!(doc = virXMLParse(absFile, NULL, NULL, NULL, NULL, NULL, false)))
+        if (!(doc = virXMLParse(absFile, NULL, NULL, (const char *) node->name,
+                                NULL, NULL, false)))
             return NULL;
 
         if (!(newnode = xmlCopyNode(xmlDocGetRootElement(doc), 1))) {