Update decode_error_kind to decode os errors to NotSupported

This commit is contained in:
Christiaan Dirkx 2021-02-13 00:00:54 +01:00
parent 4a15bd8eaf
commit 9f589b023f
4 changed files with 4 additions and 0 deletions

View File

@ -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

View File

@ -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

View File

@ -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,
}
}

View File

@ -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,
_ => {}
}