From 9f589b023fd4e38b6c14b5b174a8e5814c822fb0 Mon Sep 17 00:00:00 2001 From: Christiaan Dirkx Date: Sat, 13 Feb 2021 00:00:54 +0100 Subject: [PATCH] Update `decode_error_kind` to decode os errors to `NotSupported` --- library/std/src/sys/unix/mod.rs | 1 + library/std/src/sys/vxworks/mod.rs | 1 + library/std/src/sys/wasi/mod.rs | 1 + library/std/src/sys/windows/mod.rs | 1 + 4 files changed, 4 insertions(+) diff --git a/library/std/src/sys/unix/mod.rs b/library/std/src/sys/unix/mod.rs index 44328ffc22e..7b99e0fe1f9 100644 --- a/library/std/src/sys/unix/mod.rs +++ b/library/std/src/sys/unix/mod.rs @@ -148,6 +148,7 @@ pub fn decode_error_kind(errno: i32) -> ErrorKind { libc::EINVAL => ErrorKind::InvalidInput, libc::ETIMEDOUT => ErrorKind::TimedOut, libc::EEXIST => ErrorKind::AlreadyExists, + libc::ENOSYS => ErrorKind::NotSupported, // These two constants can have the same value on some systems, // but different values on others, so we can't use a match diff --git a/library/std/src/sys/vxworks/mod.rs b/library/std/src/sys/vxworks/mod.rs index c20edaa1a47..95e4baf3a6d 100644 --- a/library/std/src/sys/vxworks/mod.rs +++ b/library/std/src/sys/vxworks/mod.rs @@ -83,6 +83,7 @@ pub fn decode_error_kind(errno: i32) -> ErrorKind { libc::EINVAL => ErrorKind::InvalidInput, libc::ETIMEDOUT => ErrorKind::TimedOut, libc::EEXIST => ErrorKind::AlreadyExists, + libc::ENOSYS => ErrorKind::NotSupported, // These two constants can have the same value on some systems, // but different values on others, so we can't use a match diff --git a/library/std/src/sys/wasi/mod.rs b/library/std/src/sys/wasi/mod.rs index a0a37ef8316..c772fc0be69 100644 --- a/library/std/src/sys/wasi/mod.rs +++ b/library/std/src/sys/wasi/mod.rs @@ -78,6 +78,7 @@ pub fn decode_error_kind(errno: i32) -> std_io::ErrorKind { wasi::ERRNO_TIMEDOUT => TimedOut, wasi::ERRNO_EXIST => AlreadyExists, wasi::ERRNO_AGAIN => WouldBlock, + wasi::ERRNO_NOSYS => NotSupported, _ => Other, } } diff --git a/library/std/src/sys/windows/mod.rs b/library/std/src/sys/windows/mod.rs index 0353c9811f1..c8fada3c0c2 100644 --- a/library/std/src/sys/windows/mod.rs +++ b/library/std/src/sys/windows/mod.rs @@ -78,6 +78,7 @@ pub fn decode_error_kind(errno: i32) -> ErrorKind { | c::ERROR_IPSEC_IKE_TIMED_OUT | c::ERROR_RUNLEVEL_SWITCH_TIMEOUT | c::ERROR_RUNLEVEL_SWITCH_AGENT_TIMEOUT => return ErrorKind::TimedOut, + c::ERROR_CALL_NOT_IMPLEMENTED => return ErrorKind::NotSupported, _ => {} }