Skip to content

Commit

Permalink
merge syscall blocks together
Browse files Browse the repository at this point in the history
- increase the readability
  • Loading branch information
stlankes authored and Thomasdezeeuw committed Mar 4, 2024
1 parent c079fab commit 2dd7e54
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions src/sys/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,11 @@
macro_rules! syscall {
($fn: ident ( $($arg: expr),* $(,)* ) ) => {{
let res = unsafe { libc::$fn($($arg, )*) };
#[cfg(target_os = "hermit")]
if res < 0 {
Err(std::io::Error::last_os_error())
} else {
Ok(res)
}
#[cfg(unix)]
if res == -1 {
Err(std::io::Error::last_os_error())
} else {
Ok(res)
}
}};
}

Expand Down

0 comments on commit 2dd7e54

Please sign in to comment.