authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-08-14 12:33:59-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-08-14 23:10:29-07:00
loge395c24c6dc4b8ad7688c1ad7754697166551bcb
tree634cabe3e1d563fd90e976c36aadde7f21d449a2
parent47e65287629f5d9138d8d494812f9ed724d7887e

std.fs.File.Reader: fix freestanding build failures

This should be enough to unblock people for now. We'll revisit the way these things are organized with the upcoming std.Io interface. fixes #24685

1 files changed, 8 insertions(+), 0 deletions(-)

lib/std/fs/File.zig+8
......@@ -1214,6 +1214,10 @@ pub const Reader = struct {
12141214 return err;
12151215 }
12161216 }
1217 if (posix.Stat == void) {
1218 r.size_err = error.Streaming;
1219 return error.Streaming;
1220 }
12171221 if (stat(r.file)) |st| {
12181222 if (st.kind == .file) {
12191223 r.size = st.size;
......@@ -1236,6 +1240,10 @@ pub const Reader = struct {
12361240 setPosAdjustingBuffer(r, @intCast(@as(i64, @intCast(r.pos)) + offset));
12371241 },
12381242 .streaming, .streaming_reading => {
1243 if (posix.SEEK == void) {
1244 r.seek_err = error.Unseekable;
1245 return error.Unseekable;
1246 }
12391247 const seek_err = r.seek_err orelse e: {
12401248 if (posix.lseek_CUR(r.file.handle, offset)) |_| {
12411249 setPosAdjustingBuffer(r, @intCast(@as(i64, @intCast(r.pos)) + offset));