mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
testParseXMLDocFromFile: Validate that the replaced node is identical with parsed root
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>
This commit is contained in:
parent
b46667ac6f
commit
ee3b96bcb0
@ -851,7 +851,8 @@ testParseXMLDocFromFile(xmlNodePtr node,
|
|||||||
g_autofree char *absFile = testBuildFilename(file, relFile);
|
g_autofree char *absFile = testBuildFilename(file, relFile);
|
||||||
xmlNodePtr newnode = NULL;
|
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;
|
return NULL;
|
||||||
|
|
||||||
if (!(newnode = xmlCopyNode(xmlDocGetRootElement(doc), 1))) {
|
if (!(newnode = xmlCopyNode(xmlDocGetRootElement(doc), 1))) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user