[Libosinfo] [libosinfo PATCH 5/6] media: Only error out if a media is not bootable when REQUIRE_BOOTABLE flag is passed

Fabiano Fidêncio fidencio at redhat.com
Mon Jun 24 13:16:49 UTC 2019


It'll give more flexibility for the apps to, at least, detect a media,
even if the media is not bootable.

https://gitlab.com/libosinfo/libosinfo/issues/15

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

diff --git a/osinfo/osinfo_media.c b/osinfo/osinfo_media.c
index 0c3c0e3..69813db 100644
--- a/osinfo/osinfo_media.c
+++ b/osinfo/osinfo_media.c
@@ -1068,8 +1068,16 @@ static void search_ppc_bootinfo_callback(GObject *source,
     data = (CreateFromLocationAsyncData *)user_data;
 
     ret = search_ppc_bootinfo_finish(res, &error);
-    if (!ret)
-        goto cleanup;
+    if (!ret) {
+        if (g_error_matches(error,
+                            OSINFO_MEDIA_ERROR,
+                            OSINFO_MEDIA_ERROR_NOT_BOOTABLE)) {
+            if ((data->flags & OSINFO_MEDIA_DETECT_REQUIRE_BOOTABLE) != 0)
+                goto cleanup;
+            else
+                g_clear_error(&error);
+        }
+    }
 
     media = create_from_location_async_data(data);
 
-- 
2.21.0




More information about the Libosinfo mailing list