From 4cdbde55b4b1adcd27be3b0a3d7c888e90df2399 Mon Sep 17 00:00:00 2001 From: Michael Dusan Date: Mon, 2 Jan 2023 19:18:32 -0500 Subject: [PATCH] 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 --- lib/std/os.zig | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/std/os.zig b/lib/std/os.zig index b0884cef05..b5a541d191 100644 --- 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),