diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-02-11 21:48:42 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-11 21:48:42 +0100 |
| commit | ce4df92c8c4740ec90b2d0f9c1406cb3f20cd511 (patch) | |
| tree | 003b71cfe4e1b2332b699e58b9938e5948e90e14 /library/std/src/sys | |
| parent | 6499c5e7fc173a3f55b7a3bd1e6a50e9edef782d (diff) | |
| parent | a898b31662aee14c9aaa46f39377724c7ae590b5 (diff) | |
| download | rust-ce4df92c8c4740ec90b2d0f9c1406cb3f20cd511.tar.gz rust-ce4df92c8c4740ec90b2d0f9c1406cb3f20cd511.zip | |
Rollup merge of #90955 - JohnTitor:os-error-123-as-invalid-input, r=m-ou-se
Rename `FilenameTooLong` to `InvalidFilename` and also use it for Windows' `ERROR_INVALID_NAME` Address https://github.com/rust-lang/rust/issues/90940#issuecomment-970157931 `ERROR_INVALID_NAME` (i.e. "The filename, directory name, or volume label syntax is incorrect") happens if we pass an invalid filename, directory name, or label syntax, so mapping as `InvalidInput` is reasonable to me.
Diffstat (limited to 'library/std/src/sys')
| -rw-r--r-- | library/std/src/sys/unix/mod.rs | 2 | ||||
| -rw-r--r-- | library/std/src/sys/windows/mod.rs | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/library/std/src/sys/unix/mod.rs b/library/std/src/sys/unix/mod.rs index 6382354eb6e..605cc499b3c 100644 --- a/library/std/src/sys/unix/mod.rs +++ b/library/std/src/sys/unix/mod.rs @@ -159,7 +159,7 @@ pub fn decode_error_kind(errno: i32) -> ErrorKind { libc::ENOSPC => StorageFull, libc::ENOSYS => Unsupported, libc::EMLINK => TooManyLinks, - libc::ENAMETOOLONG => FilenameTooLong, + libc::ENAMETOOLONG => InvalidFilename, libc::ENETDOWN => NetworkDown, libc::ENETUNREACH => NetworkUnreachable, libc::ENOTCONN => NotConnected, diff --git a/library/std/src/sys/windows/mod.rs b/library/std/src/sys/windows/mod.rs index c70f254cf39..dc288176346 100644 --- a/library/std/src/sys/windows/mod.rs +++ b/library/std/src/sys/windows/mod.rs @@ -71,6 +71,7 @@ pub fn decode_error_kind(errno: i32) -> ErrorKind { c::ERROR_FILE_NOT_FOUND => return NotFound, c::ERROR_PATH_NOT_FOUND => return NotFound, c::ERROR_NO_DATA => return BrokenPipe, + c::ERROR_INVALID_NAME => return InvalidFilename, c::ERROR_INVALID_PARAMETER => return InvalidInput, c::ERROR_NOT_ENOUGH_MEMORY | c::ERROR_OUTOFMEMORY => return OutOfMemory, c::ERROR_SEM_TIMEOUT @@ -104,7 +105,7 @@ pub fn decode_error_kind(errno: i32) -> ErrorKind { c::ERROR_POSSIBLE_DEADLOCK => return Deadlock, c::ERROR_NOT_SAME_DEVICE => return CrossesDevices, c::ERROR_TOO_MANY_LINKS => return TooManyLinks, - c::ERROR_FILENAME_EXCED_RANGE => return FilenameTooLong, + c::ERROR_FILENAME_EXCED_RANGE => return InvalidFilename, _ => {} } |
