From f79b487337d7d11ae35fd4a15294c75e23c5f02b Mon Sep 17 00:00:00 2001 From: Yorhel Date: Fri, 30 Apr 2021 11:29:37 +0200 Subject: [PATCH] Handle EPERM and ELOOP in os.fstatat() --- lib/std/os.zig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/std/os.zig b/lib/std/os.zig index 7342db0d01..dfebda6104 100644 --- a/lib/std/os.zig +++ b/lib/std/os.zig @@ -3419,7 +3419,7 @@ pub fn fstat(fd: fd_t) FStatError!Stat { } } -pub const FStatAtError = FStatError || error{ NameTooLong, FileNotFound }; +pub const FStatAtError = FStatError || error{ NameTooLong, FileNotFound, SymLinkLoop }; /// Similar to `fstat`, but returns stat of a resource pointed to by `pathname` /// which is relative to `dirfd` handle. @@ -3466,8 +3466,10 @@ pub fn fstatatZ(dirfd: fd_t, pathname: [*:0]const u8, flags: u32) FStatAtError!S EBADF => unreachable, // Always a race condition. ENOMEM => return error.SystemResources, EACCES => return error.AccessDenied, + EPERM => return error.AccessDenied, EFAULT => unreachable, ENAMETOOLONG => return error.NameTooLong, + ELOOP => return error.SymLinkLoop, ENOENT => return error.FileNotFound, ENOTDIR => return error.FileNotFound, else => |err| return unexpectedErrno(err),