Skip to content

Commit 475e875

Browse files
committed
last_posix_errno
1 parent 37d1872 commit 475e875

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

crates/common/src/os.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,12 @@ pub fn last_os_error() -> io::Error {
4343

4444
#[cfg(windows)]
4545
pub fn last_posix_errno() -> i32 {
46-
let err = io::Error::last_os_error();
47-
if err.raw_os_error() == Some(0) {
48-
unsafe extern "C" {
49-
fn _get_errno(pValue: *mut i32) -> i32;
50-
}
51-
let mut errno = 0;
52-
unsafe { suppress_iph!(_get_errno(&mut errno)) };
53-
errno
54-
} else {
55-
err.posix_errno()
46+
unsafe extern "C" {
47+
fn _get_errno(pValue: *mut i32) -> i32;
5648
}
49+
let mut errno = 0;
50+
unsafe { suppress_iph!(_get_errno(&mut errno)) };
51+
errno
5752
}
5853

5954
#[cfg(not(windows))]

0 commit comments

Comments
 (0)