[Libosinfo] [PATCH 3/3] test-isodetect: Don't set size when block size is unknown

Christophe Fergeau cfergeau at redhat.com
Fri Oct 16 14:36:25 UTC 2015


When parsing an isoinfo file, we don't try to set the volume size if the
'vol_size' was not set. This commit does the same when 'blk_size' is not
set as volume size is set to vol_size * blk_size.
---
 test/test-isodetect.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/test-isodetect.c b/test/test-isodetect.c
index 6d864c2..4b7d9cc 100644
--- a/test/test-isodetect.c
+++ b/test/test-isodetect.c
@@ -93,7 +93,7 @@ static struct ISOInfo *load_iso(GFile *file, const gchar *shortid, const gchar *
     GDataInputStream *dis = NULL;
     gchar *line;
     const gchar *arch;
-    gint64 vol_size = -1, blk_size;
+    gint64 vol_size = -1, blk_size = -1;
 
     if (!(fis = g_file_read(file, NULL, error)))
         goto error;
@@ -158,7 +158,7 @@ static struct ISOInfo *load_iso(GFile *file, const gchar *shortid, const gchar *
             osinfo_entity_set_param(OSINFO_ENTITY(info->media), key, value);
     }
 
-    if (vol_size > 0)
+    if (vol_size > 0 && blk_size > 0)
         osinfo_entity_set_param_int64(OSINFO_ENTITY(info->media),
                                       OSINFO_MEDIA_PROP_VOLUME_SIZE,
                                       vol_size * blk_size);
-- 
2.5.0




More information about the Libosinfo mailing list