Re: [libvirt-glib 02/23] gvir_config_object_parse: don't parse empty documents

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

 



On Fri, Oct 07, 2011 at 11:40:47AM +0200, Christophe Fergeau wrote:
> Report an error when trying to parse the current XML document
> associated with the GVirConfig object when no document has been
> set.
> ---
>  libvirt-gconfig/libvirt-gconfig-object.c |    8 ++++++++
>  1 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/libvirt-gconfig/libvirt-gconfig-object.c b/libvirt-gconfig/libvirt-gconfig-object.c
> index 4a58323..6f80346 100644
> --- a/libvirt-gconfig/libvirt-gconfig-object.c
> +++ b/libvirt-gconfig/libvirt-gconfig-object.c
> @@ -187,6 +187,14 @@ gvir_config_object_parse(GVirConfigObject *config,
>      if (priv->docHandle)
>          return;
>  
> +    if (!priv->doc) {
> +        *err = g_error_new(GVIR_CONFIG_OBJECT_ERROR,
> +                           0,
> +                           "%s",
> +                           "No XML document to parse");
> +        return;
> +    }
> +
>      priv->docHandle = xmlParseMemory(priv->doc, strlen(priv->doc));
>      if (!priv->docHandle) {
>          *err = gvir_xml_error_new(GVIR_CONFIG_OBJECT_ERROR,

ACK

Seeing this string message reminds me that we should add I18N gettext
support to this library sometime soon.

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 :|

--
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]