zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 4cdbde55b4b1adcd27be3b0a3d7c888e90df2399 (tree)
parent e872c72c553992f07348a7000db821c553d267e5
Author: Michael Dusan <michael.dusan@gmail.com>
Date:   Mon,  2 Jan 2023 19:18:32 -0500

macos: getFdPath: handle E.NOSPC

- per darwin-xnu source, fcntl F_GETPATH will return ENOSPC when path
  exceeds either user-supplied buffer or system MAXPATHLEN
- macOS does not document this (and other) possible errno values

Diffstat:
Mlib/std/os.zig | 1+
1 file changed, 1 insertion(+), 0 deletions(-)

diff --git a/lib/std/os.zig b/lib/std/os.zig @@ -5098,6 +5098,7 @@ pub fn getFdPath(fd: fd_t, out_buffer: *[MAX_PATH_BYTES]u8) RealPathError![]u8 { switch (errno(system.fcntl(fd, F.GETPATH, out_buffer))) { .SUCCESS => {}, .BADF => return error.FileNotFound, + .NOSPC => return error.NameTooLong, // TODO man pages for fcntl on macOS don't really tell you what // errno values to expect when command is F.GETPATH... else => |err| return unexpectedErrno(err),