authorgravatar for git@yorhel.nlYorhel <git@yorhel.nl> 2021-04-30 11:29:37+02:00
committergravatar for mail@isaacfreund.comIsaac Freund <mail@isaacfreund.com> 2021-04-30 15:08:07+02:00
logf79b487337d7d11ae35fd4a15294c75e23c5f02b
tree26a22356bdf9276559032249bd4e369236cc5669
parent4e07755ce705066cdb4e20feebc5010c7e3e6d12

Handle EPERM and ELOOP in os.fstatat()


1 files changed, 3 insertions(+), 1 deletions(-)

lib/std/os.zig+3-1
...@@ -3419,7 +3419,7 @@ pub fn fstat(fd: fd_t) FStatError!Stat {...@@ -3419,7 +3419,7 @@ pub fn fstat(fd: fd_t) FStatError!Stat {
3419 }3419 }
3420}3420}
34213421
3422pub const FStatAtError = FStatError || error{ NameTooLong, FileNotFound };3422pub const FStatAtError = FStatError || error{ NameTooLong, FileNotFound, SymLinkLoop };
34233423
3424/// Similar to `fstat`, but returns stat of a resource pointed to by `pathname`3424/// Similar to `fstat`, but returns stat of a resource pointed to by `pathname`
3425/// which is relative to `dirfd` handle.3425/// which is relative to `dirfd` handle.
...@@ -3466,8 +3466,10 @@ pub fn fstatatZ(dirfd: fd_t, pathname: [*:0]const u8, flags: u32) FStatAtError!S...@@ -3466,8 +3466,10 @@ pub fn fstatatZ(dirfd: fd_t, pathname: [*:0]const u8, flags: u32) FStatAtError!S
3466 EBADF => unreachable, // Always a race condition.3466 EBADF => unreachable, // Always a race condition.
3467 ENOMEM => return error.SystemResources,3467 ENOMEM => return error.SystemResources,
3468 EACCES => return error.AccessDenied,3468 EACCES => return error.AccessDenied,
3469 EPERM => return error.AccessDenied,
3469 EFAULT => unreachable,3470 EFAULT => unreachable,
3470 ENAMETOOLONG => return error.NameTooLong,3471 ENAMETOOLONG => return error.NameTooLong,
3472 ELOOP => return error.SymLinkLoop,
3471 ENOENT => return error.FileNotFound,3473 ENOENT => return error.FileNotFound,
3472 ENOTDIR => return error.FileNotFound,3474 ENOTDIR => return error.FileNotFound,
3473 else => |err| return unexpectedErrno(err),3475 else => |err| return unexpectedErrno(err),