commit 62c97b745d508a5ed7011bf3b8400fde4677b839 (tree)
parent 2674acdb77f8a144eaedbfa57a1b7fdc70dc1e60
Author: Andrew Kelley <andrew@ziglang.org>
Date: Fri, 30 Jan 2026 12:27:27 -0800
std.Io.Threaded: stop checking bytes read with END_OF_FILE
Diffstat:
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/lib/std/Io/Threaded.zig b/lib/std/Io/Threaded.zig
@@ -8816,9 +8816,10 @@ fn fileReadStreamingPosix(file: File, data: []const []u8) File.ReadStreamingErro
fn fileReadStreamingWindows(file: File, data: []const []u8) File.ReadStreamingError!usize {
var io_status_block: windows.IO_STATUS_BLOCK = .{
.u = .{ .Status = .PENDING },
- .Information = 0,
+ .Information = undefined,
};
try ntReadFile(file.handle, data, &noopApc, null, &io_status_block);
+
while (@atomicLoad(windows.NTSTATUS, &io_status_block.u.Status, .acquire) == .PENDING) {
// Once we get here we must not return from the function until the
// operation completes, thereby releasing reference to io_status_block.
@@ -8842,10 +8843,7 @@ fn ntReadFileResult(io_status_block: *const windows.IO_STATUS_BLOCK) !usize {
.PENDING => unreachable,
.CANCELLED => unreachable,
.SUCCESS => return io_status_block.Information,
- .END_OF_FILE, .PIPE_BROKEN => {
- if (io_status_block.Information == 0) return error.EndOfStream;
- return io_status_block.Information;
- },
+ .END_OF_FILE, .PIPE_BROKEN => return error.EndOfStream,
.INVALID_DEVICE_REQUEST => return error.IsDir,
.LOCK_NOT_GRANTED => return error.LockViolation,
.ACCESS_DENIED => return error.AccessDenied,