From 8d5cc843f148dd41e462deecc0835002ebaf82a9 Mon Sep 17 00:00:00 2001
From: Jeremy Soller <jackpot51@gmail.com>
Date: Wed, 21 Sep 2022 14:47:20 -0600
Subject: [PATCH] Fix EFI disk error if media is not present

---
 src/os/uefi/mod.rs | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/os/uefi/mod.rs b/src/os/uefi/mod.rs
index 301b1fe..06529ac 100644
--- a/src/os/uefi/mod.rs
+++ b/src/os/uefi/mod.rs
@@ -92,6 +92,10 @@ impl Os<
 
     fn filesystem(&self, password_opt: Option<&[u8]>) -> syscall::Result<redoxfs::FileSystem<DiskEfi>> {
         for block_io in DiskEfi::all().into_iter() {
+            if ! block_io.0.Media.MediaPresent {
+                continue;
+            }
+
             if block_io.0.Media.LogicalPartition {
                 match redoxfs::FileSystem::open(block_io, password_opt, Some(0), false) {
                     Ok(ok) => return Ok(ok),
-- 
GitLab