[libgovirt] Allow empty <file> cdrom nodes



commit 8d27945e27f7dbbf36b8f011900446c1dbc7d9c5
Author: Christophe Fergeau <cfergeau redhat com>
Date:   Mon Oct 7 11:45:22 2013 +0200

    Allow empty <file> cdrom nodes
    
    If the virtual cdrom does not contain any ISO image, then its REST
    representation will not have a <file> node. Stop treating missing
    <file> nodes as a parsing failure.

 govirt/ovirt-cdrom.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/govirt/ovirt-cdrom.c b/govirt/ovirt-cdrom.c
index 9d2790f..cc10bd5 100644
--- a/govirt/ovirt-cdrom.c
+++ b/govirt/ovirt-cdrom.c
@@ -98,10 +98,10 @@ static gboolean ovirt_cdrom_refresh_from_xml(OvirtCdrom *cdrom,
     char *name;
 
     file_node = g_hash_table_lookup(node->children, file_key);
-    if (file_node == NULL)
-        return FALSE;
-    file = rest_xml_node_get_attr(file_node, "id");
-    cdrom->priv->file = g_strdup(file);
+    if (file_node != NULL) {
+        file = rest_xml_node_get_attr(file_node, "id");
+        cdrom->priv->file = g_strdup(file);
+    }
 
     g_object_get(G_OBJECT(cdrom), "name", &name, NULL);
     if (name == NULL) {


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