Skip to content

Commit

Permalink
bugfix: Use get_errno instead of last_os_error
Browse files Browse the repository at this point in the history
According to @stlankes this causes strange errors in Hermit proper.

Signed-off-by: John Nunley <dev@notgull.net>
  • Loading branch information
notgull committed Mar 2, 2024
1 parent dfc03be commit 4f4d9a4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ features = [
]

[target.'cfg(target_os = "hermit")'.dependencies.hermit-abi]
version = "0.3.8"
version = "0.3.9"

[dev-dependencies]
easy-parallel = "3.1.0"
Expand Down
8 changes: 6 additions & 2 deletions src/poll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,9 @@ mod syscall {
let fd = unsafe { hermit_abi::eventfd(count, 0) };

if fd == -1 {
Err(io::Error::last_os_error())
Err(io::Error::from_raw_os_error(unsafe {
hermit_abi::get_errno()
}))
} else {
Ok(unsafe { OwnedFd::from_raw_fd(fd) })
}
Expand Down Expand Up @@ -611,7 +613,9 @@ mod syscall {
#[inline]
fn cvt(len: isize) -> io::Result<usize> {
if len == -1 {
Err(io::Error::last_os_error())
Err(io::Error::from_raw_os_error(unsafe {
hermit_abi::get_errno()
}))
} else {
Ok(len as usize)
}
Expand Down

0 comments on commit 4f4d9a4

Please sign in to comment.