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
This commit is contained in:
Michael Dusan 2023-01-02 19:18:32 -05:00
parent e872c72c55
commit 4cdbde55b4
No known key found for this signature in database
GPG Key ID: ED4C5BA849FA1B74

View File

@ -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),