Skip to content

Commit

Permalink
lib: xmlParse{File,Memory} -> xmlRead{File,Memory}
Browse files Browse the repository at this point in the history
Switch from xmlParse* to xmlRead* so we can explicitly specify parsing
flags, including no network usage and no entity resolution.
The two behaviours mentioned above were not done before either, so this
should not introduce behaviour changes in libguestfs.

(cherry picked from commit 845dade)
  • Loading branch information
ptoscano authored and rwmjones committed May 7, 2014
1 parent 205d724 commit 83b0545
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/for-each-disk.c
Expand Up @@ -88,7 +88,8 @@ guestfs___for_each_disk (guestfs_h *g,
/* Now the horrible task of parsing out the fields we need from the XML.
* http://www.xmlsoft.org/examples/xpath1.c
*/
doc = xmlParseMemory (xml, strlen (xml));
doc = xmlReadMemory (xml, strlen (xml),
NULL, NULL, XML_PARSE_NONET);
if (doc == NULL) {
error_function (g, 0,
_("unable to parse XML information returned by libvirt"));
Expand Down
3 changes: 2 additions & 1 deletion src/launch-libvirt.c
Expand Up @@ -515,7 +515,8 @@ parse_capabilities (guestfs_h *g, const char *capabilities_xml,
xmlAttrPtr attr;
size_t seen_qemu, seen_kvm;

doc = xmlParseMemory (capabilities_xml, strlen (capabilities_xml));
doc = xmlReadMemory (capabilities_xml, strlen (capabilities_xml),
NULL, NULL, XML_PARSE_NONET);
if (doc == NULL) {
error (g, _("unable to parse capabilities XML returned by libvirt"));
return -1;
Expand Down
3 changes: 2 additions & 1 deletion src/libvirt-domain.c
Expand Up @@ -334,7 +334,8 @@ connect_live (guestfs_h *g, virDomainPtr dom)
}

/* Parse XML to document. */
doc = xmlParseMemory (xml, strlen (xml));
doc = xmlReadMemory (xml, strlen (xml),
NULL, NULL, XML_PARSE_NONET);
if (doc == NULL) {
error (g, _("unable to parse XML information returned by libvirt"));
return -1;
Expand Down
2 changes: 1 addition & 1 deletion src/osinfo.c
Expand Up @@ -273,7 +273,7 @@ read_osinfo_db_xml (guestfs_h *g, const char *filename)

snprintf (pathname, pathname_len, "%s/%s", LIBOSINFO_DB_OS_PATH, filename);

doc = xmlParseFile (pathname);
doc = xmlReadFile (pathname, NULL, XML_PARSE_NONET);
if (doc == NULL) {
debug (g, "osinfo: unable to parse XML file %s", pathname);
return 0;
Expand Down

0 comments on commit 83b0545

Please sign in to comment.