mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
last_posix_errno (#6341)
This commit is contained in:
1 parent
bafaa1a826
commit
7157697f96
1 file changed
+5
-10
+5
-10
@@ -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))]
|
||||
|
||||
Reference in new issue
Block a user