[libvirt] [libvirt-glib 2/3] Fix creation of empty XML document
Marc-André Lureau
marcandre.lureau at gmail.com
Wed Nov 9 20:58:32 UTC 2011
ack
On Wed, Nov 9, 2011 at 9:48 PM, Christophe Fergeau <cfergeau at redhat.com> wrote:
> It's not enough to assign xmlDocPtr::children to set the
> document root, xmlDocSetRootElement must be used instead.
> ---
> libvirt-gconfig/libvirt-gconfig-object.c | 6 ++++--
> 1 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/libvirt-gconfig/libvirt-gconfig-object.c b/libvirt-gconfig/libvirt-gconfig-object.c
> index adbd955..fbdbedd 100644
> --- a/libvirt-gconfig/libvirt-gconfig-object.c
> +++ b/libvirt-gconfig/libvirt-gconfig-object.c
> @@ -378,11 +378,13 @@ GVirConfigObject *gvir_config_object_new(GType type,
> const char *schema)
> {
> xmlDocPtr doc;
> + xmlNodePtr node;
>
> doc = xmlNewDoc((xmlChar *)"1.0");
> - doc->children = xmlNewDocNode(doc, NULL, (xmlChar *)root_name, NULL);
> + node = xmlNewDocNode(doc, NULL, (xmlChar *)root_name, NULL);
> + xmlDocSetRootElement(doc, node);
> return GVIR_CONFIG_OBJECT(g_object_new(type,
> - "node", doc->children,
> + "node", node,
> "schema", schema,
> NULL));
> }
> --
> 1.7.7
>
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
>
--
Marc-André Lureau
More information about the libvir-list
mailing list