Skip to content

Commit

Permalink
fix compilation on uefi
Browse files Browse the repository at this point in the history
  • Loading branch information
usamoi committed Dec 18, 2024
1 parent 0bb4c96 commit 4097009
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ impl fmt::Debug for Error {
let mut dbg = f.debug_struct("Error");
if let Some(errno) = self.raw_os_error() {
dbg.field("os_error", &errno);
#[cfg(feature = "std")]
#[cfg(all(feature = "std", not(target_os = "uefi")))]
dbg.field("description", &std::io::Error::from_raw_os_error(errno));
} else if let Some(desc) = self.internal_desc() {
dbg.field("internal_code", &self.0.get());
Expand All @@ -150,7 +150,7 @@ impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if let Some(errno) = self.raw_os_error() {
cfg_if! {
if #[cfg(feature = "std")] {
if #[cfg(all(feature = "std", not(target_os = "uefi")))] {
std::io::Error::from_raw_os_error(errno).fmt(f)
} else {
write!(f, "OS Error: {}", errno)
Expand Down
5 changes: 5 additions & 0 deletions src/error_std_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@ use std::io;

impl From<Error> for io::Error {
fn from(err: Error) -> Self {
#[cfg(not(target_os = "uefi"))]
match err.raw_os_error() {
Some(errno) => io::Error::from_raw_os_error(errno),
None => io::Error::new(io::ErrorKind::Other, err),
}
#[cfg(target_os = "uefi")]
{
io::Error::new(io::ErrorKind::Other, err)
}
}
}

Expand Down

0 comments on commit 4097009

Please sign in to comment.