last_posix_errno (#6341)

This commit is contained in:
Jeong, YunWon authored and GitHub committed 2025-12-09 04:41:44 +09:00
1 parent bafaa1a826
commit 7157697f96
1 file changed
+5 -10
+5 -10
View File
@@ -43,17 +43,12 @@ pub fn last_os_error() -> io::Error {
#[cfg(windows)]
pub fn last_posix_errno() -> i32 {
let err = io::Error::last_os_error();
if err.raw_os_error() == Some(0) {
unsafe extern "C" {
fn _get_errno(pValue: *mut i32) -> i32;
}
let mut errno = 0;
unsafe { suppress_iph!(_get_errno(&mut errno)) };
errno
} else {
err.posix_errno()
unsafe extern "C" {
fn _get_errno(pValue: *mut i32) -> i32;
}
let mut errno = 0;
unsafe { suppress_iph!(_get_errno(&mut errno)) };
errno
}
#[cfg(not(windows))]