about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChris Denton <chris@chrisdenton.dev>2023-04-16 23:42:59 +0100
committerChris Denton <chris@chrisdenton.dev>2023-04-16 23:42:59 +0100
commitdb8dfbdb7553e499e6a1e9e72f338eb7e4c91db9 (patch)
treeb64a24f239bf2b6c8bbd2c695b08c2c6ada02b16
parentd0f204e4d750b62f9d6c2593405e828757126832 (diff)
downloadrust-db8dfbdb7553e499e6a1e9e72f338eb7e4c91db9.tar.gz
rust-db8dfbdb7553e499e6a1e9e72f338eb7e4c91db9.zip
Windows: map a few more error codes to ErrorKind
NotFound errors:

* `ERROR_INVALID_DRIVE`: The system cannot find the drive specified
* `ERROR_BAD_NETPATH`: The network path was not found
* `ERROR_BAD_NET_NAME`: The network name cannot be found.

InvalidFilename:

* `ERROR_BAD_PATHNAME`: The specified path is invalid.
-rw-r--r--library/std/src/sys/windows/mod.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/library/std/src/sys/windows/mod.rs b/library/std/src/sys/windows/mod.rs
index 77359abe429..bcc172b0fae 100644
--- a/library/std/src/sys/windows/mod.rs
+++ b/library/std/src/sys/windows/mod.rs
@@ -68,10 +68,13 @@ pub fn decode_error_kind(errno: i32) -> ErrorKind {
         c::ERROR_ALREADY_EXISTS => return AlreadyExists,
         c::ERROR_FILE_EXISTS => return AlreadyExists,
         c::ERROR_BROKEN_PIPE => return BrokenPipe,
-        c::ERROR_FILE_NOT_FOUND => return NotFound,
-        c::ERROR_PATH_NOT_FOUND => return NotFound,
+        c::ERROR_FILE_NOT_FOUND
+        | c::ERROR_PATH_NOT_FOUND
+        | c::ERROR_INVALID_DRIVE
+        | c::ERROR_BAD_NETPATH
+        | c::ERROR_BAD_NET_NAME => return NotFound,
         c::ERROR_NO_DATA => return BrokenPipe,
-        c::ERROR_INVALID_NAME => return InvalidFilename,
+        c::ERROR_INVALID_NAME | c::ERROR_BAD_PATHNAME => return InvalidFilename,
         c::ERROR_INVALID_PARAMETER => return InvalidInput,
         c::ERROR_NOT_ENOUGH_MEMORY | c::ERROR_OUTOFMEMORY => return OutOfMemory,
         c::ERROR_SEM_TIMEOUT