[libvirt] [libvirt-glib 2/7] Make root_node optional in gvir_config_xml_parse

Daniel P. Berrange berrange at redhat.com
Mon Feb 6 11:59:36 UTC 2012


On Mon, Feb 06, 2012 at 12:56:12PM +0100, Christophe Fergeau wrote:
> It's only used to make some sanity checks on what was just parsed,
> so allowing NULL root_node is fine.
> ---
>  libvirt-gconfig/libvirt-gconfig-helpers.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/libvirt-gconfig/libvirt-gconfig-helpers.c b/libvirt-gconfig/libvirt-gconfig-helpers.c
> index fecf3eb..a9aaa0b 100644
> --- a/libvirt-gconfig/libvirt-gconfig-helpers.c
> +++ b/libvirt-gconfig/libvirt-gconfig-helpers.c
> @@ -148,7 +148,8 @@ gvir_config_xml_parse(const char *xml, const char *root_node, GError **err)
>                                        "Unable to parse configuration");
>          return NULL;
>      }
> -    if ((!doc->children) || (strcmp((char *)doc->children->name, root_node) != 0)) {
> +    if ((!doc->children) ||
> +         ((root_node != NULL) && g_strcmp0((char *)doc->children->name, root_node) != 0)) {
>          g_set_error(err,
>                      GVIR_CONFIG_OBJECT_ERROR,
>                      0,

ACK


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list