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

[libvirt] [libvirt-glib 2/3] Fix creation of empty XML document



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


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