| author | |
| committer | |
| log | 32f602ad167e90825ef1f980046a7611cfcfb5fe |
| tree | 82f2eac428620e992caba8031953561b4f8e25a8 |
| parent | 2008b14bc76b54f29b07e8570a094c17aefea9d5 |
| signature |
It's been seen on Windows 11 (22H2) Build 22621.3155 that NtCreateFile
will return the OBJECT_NAME_INVALID error code with certain path names.
The path name we saw this with started with `C:Users` (rather than
`C:\Users`) and also contained a `$` character. This PR updates our
OpenFile wrapper to propagate this error code as `error.BadPathName`
instead of making it `unreachable`.
see https://github.com/marler8997/zigup/issues/114#issuecomment-19944207911 files changed, 2 insertions(+), 1 deletions(-)
lib/std/os/windows.zig+2-1| ... | ... | @@ -42,6 +42,7 @@ pub const OpenError = error{ |
| 42 | 42 | WouldBlock, |
| 43 | 43 | NetworkNotFound, |
| 44 | 44 | AntivirusInterference, |
| 45 | BadPathName, | |
| 45 | 46 | }; |
| 46 | 47 | |
| 47 | 48 | pub const OpenFileOptions = struct { |
| ... | ... | @@ -120,7 +121,7 @@ pub fn OpenFile(sub_path_w: []const u16, options: OpenFileOptions) OpenError!HAN |
| 120 | 121 | ); |
| 121 | 122 | switch (rc) { |
| 122 | 123 | .SUCCESS => return result, |
| 123 | .OBJECT_NAME_INVALID => unreachable, | |
| 124 | .OBJECT_NAME_INVALID => return error.BadPathName, | |
| 124 | 125 | .OBJECT_NAME_NOT_FOUND => return error.FileNotFound, |
| 125 | 126 | .OBJECT_PATH_NOT_FOUND => return error.FileNotFound, |
| 126 | 127 | .BAD_NETWORK_PATH => return error.NetworkNotFound, // \\server was not found |