提交 29307fa8 编写于 作者: J Jiri Denemark

conf: Avoid checking root element name in virDomainDefParseNode

The only caller for which this check makes sense is virDomainDefParse.
Thus the check should be moved there.
Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
上级 9bcbc52e
......@@ -21520,12 +21520,21 @@ virDomainDefParse(const char *xmlStr,
xmlDocPtr xml = NULL;
virDomainDefPtr def = NULL;
int keepBlanksDefault = xmlKeepBlanksDefault(0);
xmlNodePtr root;
if (!(xml = virXMLParse(filename, xmlStr, _("(domain_definition)"))))
goto cleanup;
def = virDomainDefParseNode(xml, xmlDocGetRootElement(xml), caps,
xmlopt, parseOpaque, flags);
root = xmlDocGetRootElement(xml);
if (!virXMLNodeNameEqual(root, "domain")) {
virReportError(VIR_ERR_XML_ERROR,
_("unexpected root element <%s>, "
"expecting <domain>"),
root->name);
goto cleanup;
}
def = virDomainDefParseNode(xml, root, caps, xmlopt, parseOpaque, flags);
cleanup:
xmlFreeDoc(xml);
......@@ -21566,14 +21575,6 @@ virDomainDefParseNode(xmlDocPtr xml,
virDomainDefPtr def = NULL;
virDomainDefPtr ret = NULL;
if (!virXMLNodeNameEqual(root, "domain")) {
virReportError(VIR_ERR_XML_ERROR,
_("unexpected root element <%s>, "
"expecting <domain>"),
root->name);
goto cleanup;
}
ctxt = xmlXPathNewContext(xml);
if (ctxt == NULL) {
virReportOOMError();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册