[PATCH 2/2] XML: Suppress printing "domain.xml" for parse errors on XML strings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Patch e81778d6184f1850a10eb661eb756b50421d5ac4 introduces printing
file name on XML errors. This corrects the URL string to be NULL and
therefore to print an error message not containing bogus filename
"domain.xml".

NULL is a valid parameter for the file name value, as the only usage is
for error handlers. Functions touching the value either in libxml2 or in
libvirt check this parameter for NULL and behave according to it.
---
 src/conf/domain_conf.c        |    2 +-
 src/security/virt-aa-helper.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index cce9955..06baaaf 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -7367,7 +7367,7 @@ virDomainDefParse(const char *xmlStr,
     xmlDocPtr xml;
     virDomainDefPtr def = NULL;

-    if ((xml = virXMLParse(filename, xmlStr, "domain.xml"))) {
+    if ((xml = virXMLParse(filename, xmlStr, NULL))) {
         def = virDomainDefParseNode(caps, xml, xmlDocGetRootElement(xml),
                                     expectedVirtTypes, flags);
         xmlFreeDoc(xml);
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index bb577d3..1de2f77 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -641,7 +641,7 @@ caps_mockup(vahControl * ctl, const char *xmlStr)
     xmlDocPtr xml = NULL;
     xmlXPathContextPtr ctxt = NULL;

-    if (!(xml = virXMLParseStringCtxt(xmlStr, "domain.xml", &ctxt))) {
+    if (!(xml = virXMLParseStringCtxt(xmlStr, NULL, &ctxt))) {
         goto cleanup;
     }

-- 
1.7.3.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]