From 327e4c4f27fdedefc89317e4a42f5382fadefbf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Sun, 2 Dec 2018 16:37:59 +0100 Subject: [PATCH] db: improve _guess_os_from_tree() 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 treeinfo data as match_regex() would just match whatever we compare to it. Signed-off-by: Fabiano FidĂȘncio Reviewed-by: Christophe Fergeau (cherry picked from commit 705b08bb3fa44a2266abdd5d145544c67ef0d882) --- osinfo/osinfo_db.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osinfo/osinfo_db.c b/osinfo/osinfo_db.c index fa14c6d..4f8684a 100644 --- a/osinfo/osinfo_db.c +++ b/osinfo/osinfo_db.c @@ -763,6 +763,12 @@ OsinfoOs *osinfo_db_guess_os_from_tree(OsinfoDb *db, const gchar *os_version = osinfo_tree_get_treeinfo_version(os_tree); const gchar *os_arch = osinfo_tree_get_treeinfo_arch(os_tree); + if (os_family == NULL && + os_variant == NULL && + os_version == NULL && + os_arch == NULL) + continue; + if (match_regex(os_family, tree_family) && match_regex(os_variant, tree_variant) && match_regex(os_version, tree_version) && -- 2.21.0