commit 6aa31cedb7b5461c06d43b813d70ab6c21375cce (tree)
parent 3e624e17a40fd65b68dbec45030280008c6b4018
Author: Andrew Kelley <andrew@ziglang.org>
Date: Fri, 19 Dec 2025 14:50:04 -0800
std.Io.Dir.Reader: fix min_buffer_len on 32-bit linux
dirents64 still uses 8 byte alignment on 32-bit systems
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/std/Io/Dir.zig b/lib/std/Io/Dir.zig
@@ -103,8 +103,8 @@ pub const Reader = struct {
/// A length for `buffer` that allows all implementations to function.
pub const min_buffer_len = switch (native_os) {
- .linux => @sizeOf(std.os.linux.dirent64) +
- std.mem.alignForward(usize, max_name_bytes, @alignOf(std.os.linux.dirent64)),
+ .linux => std.mem.alignForward(usize, @sizeOf(std.os.linux.dirent64), 8) +
+ std.mem.alignForward(usize, max_name_bytes, 8),
.windows => std.mem.alignForward(usize, max_name_bytes, @alignOf(usize)),
else => if (builtin.link_libc) @sizeOf(std.c.dirent) else std.mem.alignForward(usize, max_name_bytes, @alignOf(usize)),
};