about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAyush Singh <ayush@beagleboard.org>2025-04-13 20:11:44 +0530
committerAyush Singh <ayush@beagleboard.org>2025-04-13 23:22:59 +0530
commitaf25995d11f8630a071a7f4776f0798d22942a9f (patch)
tree7c05106f74778802bc4dac6a873a044d21087052
parenta404015775276f2e21e16c69fab36cc8228d51f6 (diff)
downloadrust-af25995d11f8630a071a7f4776f0798d22942a9f.tar.gz
rust-af25995d11f8630a071a7f4776f0798d22942a9f.zip
std: sys: stdio: uefi: Tread UNSUPPORTED Status as read(0)
Allows implementing Stdio::Null for Command in a deterministic manner.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
-rw-r--r--library/std/src/sys/stdio/uefi.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/library/std/src/sys/stdio/uefi.rs b/library/std/src/sys/stdio/uefi.rs
index 257e321dd03..ccd6bf658b0 100644
--- a/library/std/src/sys/stdio/uefi.rs
+++ b/library/std/src/sys/stdio/uefi.rs
@@ -142,8 +142,12 @@ impl io::Write for Stderr {
 // UTF-16 character should occupy 4 bytes at most in UTF-8
 pub const STDIN_BUF_SIZE: usize = 4;
 
-pub fn is_ebadf(_err: &io::Error) -> bool {
-    false
+pub fn is_ebadf(err: &io::Error) -> bool {
+    if let Some(x) = err.raw_os_error() {
+        r_efi::efi::Status::UNSUPPORTED.as_usize() == x
+    } else {
+        false
+    }
 }
 
 pub fn panic_output() -> Option<impl io::Write> {