freebsd: getFdPath: handle NameTooLong

This commit is contained in:
Michael Dusan 2023-01-02 19:18:33 -05:00
parent 537624734c
commit bd071c98a5
No known key found for this signature in database
GPG Key ID: ED4C5BA849FA1B74

View File

@ -5140,6 +5140,7 @@ pub fn getFdPath(fd: fd_t, out_buffer: *[MAX_PATH_BYTES]u8) RealPathError![]u8 {
else => |err| return unexpectedErrno(err),
}
const len = mem.indexOfScalar(u8, &kfile.path, 0) orelse MAX_PATH_BYTES;
if (len == 0) return error.NameTooLong;
mem.copy(u8, out_buffer, kfile.path[0..len]);
return out_buffer[0..len];
} else {