[virt-tools-list] [libosinfo 2/2] Correct & further restrict media matching logic

Zeeshan Ali (Khattak) zeeshanak at gnome.org
Thu Feb 23 00:00:42 UTC 2012


From: "Zeeshan Ali (Khattak)" <zeeshanak at gnome.org>

Recently we started to use application IDs for detection, which is
itself a good change but we ended-up turning the matching logic a lot
more liberal than it should be. This patches fixes that and makes the
application ID match compulsory.
---
 osinfo/osinfo_db.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/osinfo/osinfo_db.c b/osinfo/osinfo_db.c
index ecc8fbd..d1eba9f 100644
--- a/osinfo/osinfo_db.c
+++ b/osinfo/osinfo_db.c
@@ -386,11 +386,10 @@ OsinfoOs *osinfo_db_guess_os_from_media(OsinfoDb *db,
             const gchar *os_publisher = osinfo_media_get_publisher_id(os_media);
             const gchar *os_application = osinfo_media_get_application_id(os_media);
 
-            if ((match_regex (os_volume, media_volume) ||
-                 match_regex (os_application, media_application))
-                 &&
-                (match_regex (os_system, media_system) ||
-                 match_regex (os_publisher, media_publisher))) {
+            if (match_regex (os_volume, media_volume) &&
+                match_regex (os_system, media_system) &&
+                match_regex (os_application, media_application) &&
+                match_regex (os_publisher, media_publisher)) {
                 ret = os;
                 if (matched_media != NULL)
                     *matched_media = os_media;
-- 
1.7.7.6




More information about the virt-tools-list mailing list