authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-01-06 20:44:59-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-01-07 11:03:37-08:00
log7e8c7e56964f8d9d20be04e314324f84f9db6146
tree6a61f5c6a341a7f35f68f24bd070da1ed1f31119
parentee574f665c4e3d1be4950b307ce3ff8324f13f46

std.Io: fix AT_SYMLINK_FOLLOW flags

hard linking has the backwards default, which uses a different flag

2 files changed, 4 insertions(+), 4 deletions(-)

lib/std/Io/File.zig+1-1
......@@ -709,7 +709,7 @@ pub fn realPath(file: File, io: Io, out_buffer: []u8) RealPathError!usize {
709709}
710710
711711pub const HardLinkOptions = struct {
712 follow_symlinks: bool = true,
712 follow_symlinks: bool = false,
713713};
714714
715715pub const HardLinkError = error{
lib/std/Io/Threaded.zig+3-3
......@@ -5249,8 +5249,8 @@ fn fileHardLink(
52495249 var new_path_buffer: [posix.PATH_MAX]u8 = undefined;
52505250 const new_sub_path_posix = try pathToPosix(new_sub_path, &new_path_buffer);
52515251
5252 const flags: u32 = if (!options.follow_symlinks)
5253 posix.AT.SYMLINK_NOFOLLOW | posix.AT.EMPTY_PATH
5252 const flags: u32 = if (options.follow_symlinks)
5253 posix.AT.SYMLINK_FOLLOW | posix.AT.EMPTY_PATH
52545254 else
52555255 posix.AT.EMPTY_PATH;
52565256
......@@ -7829,7 +7829,7 @@ fn dirHardLink(
78297829 const old_sub_path_posix = try pathToPosix(old_sub_path, &old_path_buffer);
78307830 const new_sub_path_posix = try pathToPosix(new_sub_path, &new_path_buffer);
78317831
7832 const flags: u32 = if (!options.follow_symlinks) posix.AT.SYMLINK_NOFOLLOW else 0;
7832 const flags: u32 = if (options.follow_symlinks) posix.AT.SYMLINK_FOLLOW else 0;
78337833 return linkat(old_dir.handle, old_sub_path_posix, new_dir.handle, new_sub_path_posix, flags);
78347834}
78357835