From 89afd4bd33c72c2e608974d182f4624078da3a7f Mon Sep 17 00:00:00 2001 From: Jeremy Fillingim Date: Sun, 28 Nov 2021 03:40:50 +0000 Subject: [PATCH] libstd: handle rmdirZ INVAL error (#10145) The INVAL error was marked unreachable which prevents handling of the error at a higher level. It seems like it should map to BadPathError based on the man page for rmdir (and an incomplete understanding of DeleteDirError), which says: ``` EINVAL pathname has . as last component. ``` --- lib/std/os.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/std/os.zig b/lib/std/os.zig index 5923f90a63..b3c8231123 100644 --- a/lib/std/os.zig +++ b/lib/std/os.zig @@ -2538,7 +2538,7 @@ pub fn rmdirZ(dir_path: [*:0]const u8) DeleteDirError!void { .PERM => return error.AccessDenied, .BUSY => return error.FileBusy, .FAULT => unreachable, - .INVAL => unreachable, + .INVAL => return error.BadPathName, .LOOP => return error.SymLinkLoop, .NAMETOOLONG => return error.NameTooLong, .NOENT => return error.FileNotFound,