[Libosinfo] [libosinfo PATCH 1/1] db: improve _guess_os_from_media() checks

Fabiano Fidêncio fidencio at redhat.com
Mon Jan 14 16:08:11 UTC 2019


Do not check against a distro which doesn't have *any* of the values we
use to check as match_regex() would just match whatever we compare to
it.

Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
---
 osinfo/osinfo_db.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/osinfo/osinfo_db.c b/osinfo/osinfo_db.c
index a12cee8..5696279 100644
--- a/osinfo/osinfo_db.c
+++ b/osinfo/osinfo_db.c
@@ -577,6 +577,13 @@ osinfo_db_guess_os_from_media_internal(OsinfoDb *db,
             const gchar *os_application = osinfo_media_get_application_id(os_media);
             gint64 os_vol_size = osinfo_media_get_volume_size(os_media);
 
+            if (os_volume == NULL &&
+                os_system == NULL &&
+                os_publisher == NULL &&
+                os_application == NULL &&
+                os_vol_size <= 0)
+                continue;
+
             if (os_vol_size <= 0)
                 os_vol_size = media_vol_size;
 
-- 
2.19.2




More information about the Libosinfo mailing list