From ff471e84587597029ab0f1f67b1dc11f5578a0ee Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <fidencio@redhat.com>
Date: Mon, 14 Jan 2019 17:08:11 +0100
Subject: [PATCH] db: improve _guess_os_from_media() checks
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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@redhat.com>
(cherry picked from commit 8969c436ebc6e9610172b124e638efea21d9eae8)
---
 osinfo/osinfo_db.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/osinfo/osinfo_db.c b/osinfo/osinfo_db.c
index 4f8684a..5dc0aac 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.21.0

