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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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

_______________________________________________
Libosinfo mailing list
Libosinfo@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libosinfo




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux