From cc8fb7cb1654df835a48473d67c001a44d2a6ea9 Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Mon, 1 Sep 2025 14:32:20 -0700 Subject: [PATCH] fix fd_realpath for 0.14 --- src/lib.zig | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lib.zig b/src/lib.zig index 53fd32f7882d3c80e8d33cc0a90360019254b79f..d7235e50369e6a85e4a76fa43c544e42f4ee8c67 100644 --- a/src/lib.zig +++ b/src/lib.zig @@ -74,11 +74,11 @@ pub usingnamespace @import("./AnyReader.zig"); pub usingnamespace @import("./sum.zig"); pub usingnamespace @import("./RingBuffer.zig"); -pub fn fd_realpath(fd: std.posix.fd_t) ![std.fs.MAX_PATH_BYTES:0]u8 { +pub fn fd_realpath(fd: std.posix.fd_t) ![std.fs.max_path_bytes:0]u8 { switch (builtin.os.tag) { .linux => { var buf = std.mem.zeroes([64]u8); - var res = std.mem.zeroes([std.fs.MAX_PATH_BYTES:0]u8); + var res = std.mem.zeroes([std.fs.max_path_bytes:0]u8); const str = try std.fmt.bufPrint(&buf, "/proc/self/fd/{d}", .{fd}); _ = try std.posix.readlink(str, &res); return res; @@ -86,6 +86,10 @@ pub fn fd_realpath(fd: std.posix.fd_t) ![std.fs.MAX_PATH_BYTES:0]u8 { else => @compileError("not implemented!"), } } +test { + if (builtin.os.tag != .linux) return; + _ = &fd_realpath; +} pub usingnamespace @import("./rawInt.zig"); pub usingnamespace @import("./expectSimilarType.zig"); -- 2.54.0