[virt-tools-list] [osinfo PATCH 2/3] Fix "insufficient metadata" test in on_pvd_read

Christophe Fergeau cfergeau at redhat.com
Thu Dec 1 09:25:49 UTC 2011


There are 2 issues with this test:
1) it's not using is_str_empty, which means it won't do what's
expected on some ISOs where "empty" descriptors are read as a
string full of blank space
2) it mandates the presence of a system or publisher descriptor in
ISOs, which is not the case on ubuntu 11.10 ISOs. They only have a
volume descriptor. Since on most ISOs, publisher is empty and
system is "LINUX", they don't add much to discriminate between ISOs,
so we don't really need to mandate the presence of one of these.
---
 osinfo/osinfo_media.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/osinfo/osinfo_media.c b/osinfo/osinfo_media.c
index f9769cf..3694a9b 100644
--- a/osinfo/osinfo_media.c
+++ b/osinfo/osinfo_media.c
@@ -626,8 +626,7 @@ static void on_pvd_read (GObject *source,
     data->pvd.system[MAX_SYSTEM - 1] = 0;
     data->pvd.publisher[MAX_PUBLISHER - 1] = 0;
 
-    if (data->pvd.volume[0] &&
-        (data->pvd.system[0] == 0 && data->pvd.publisher[0] == 0)) {
+    if (is_str_empty(data->pvd.volume)) {
         g_set_error(&error,
                     OSINFO_MEDIA_ERROR,
                     OSINFO_MEDIA_ERROR_INSUFFIENT_METADATA,
-- 
1.7.7.3




More information about the virt-tools-list mailing list