Commit 4cdbde55b4

Michael Dusan <michael.dusan@gmail.com>
2023-01-03 01:18:32
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
1 parent e872c72
Changed files (1)
lib
std
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),