authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-01-30 12:27:27-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-01-30 16:58:26-08:00
logdd463caa15f2474880085ddff073d619d02a5610
tree60393e7e2c82d95d2180395a4b6f6751adf44390
parent3d3f22a14d7639f1a7c607da98926da6e60c3b01

std.Io.Threaded: stop checking bytes read with END_OF_FILE


1 files changed, 3 insertions(+), 5 deletions(-)

lib/std/Io/Threaded.zig+3-5
...@@ -8816,9 +8816,10 @@ fn fileReadStreamingPosix(file: File, data: []const []u8) File.ReadStreamingErro...@@ -8816,9 +8816,10 @@ fn fileReadStreamingPosix(file: File, data: []const []u8) File.ReadStreamingErro
8816fn fileReadStreamingWindows(file: File, data: []const []u8) File.ReadStreamingError!usize {8816fn fileReadStreamingWindows(file: File, data: []const []u8) File.ReadStreamingError!usize {
8817 var io_status_block: windows.IO_STATUS_BLOCK = .{8817 var io_status_block: windows.IO_STATUS_BLOCK = .{
8818 .u = .{ .Status = .PENDING },8818 .u = .{ .Status = .PENDING },
8819 .Information = 0,8819 .Information = undefined,
8820 };8820 };
8821 try ntReadFile(file.handle, data, &noopApc, null, &io_status_block);8821 try ntReadFile(file.handle, data, &noopApc, null, &io_status_block);
8822
8822 while (@atomicLoad(windows.NTSTATUS, &io_status_block.u.Status, .acquire) == .PENDING) {8823 while (@atomicLoad(windows.NTSTATUS, &io_status_block.u.Status, .acquire) == .PENDING) {
8823 // Once we get here we must not return from the function until the8824 // Once we get here we must not return from the function until the
8824 // operation completes, thereby releasing reference to io_status_block.8825 // operation completes, thereby releasing reference to io_status_block.
...@@ -8842,10 +8843,7 @@ fn ntReadFileResult(io_status_block: *const windows.IO_STATUS_BLOCK) !usize {...@@ -8842,10 +8843,7 @@ fn ntReadFileResult(io_status_block: *const windows.IO_STATUS_BLOCK) !usize {
8842 .PENDING => unreachable,8843 .PENDING => unreachable,
8843 .CANCELLED => unreachable,8844 .CANCELLED => unreachable,
8844 .SUCCESS => return io_status_block.Information,8845 .SUCCESS => return io_status_block.Information,
8845 .END_OF_FILE, .PIPE_BROKEN => {8846 .END_OF_FILE, .PIPE_BROKEN => return error.EndOfStream,
8846 if (io_status_block.Information == 0) return error.EndOfStream;
8847 return io_status_block.Information;
8848 },
8849 .INVALID_DEVICE_REQUEST => return error.IsDir,8847 .INVALID_DEVICE_REQUEST => return error.IsDir,
8850 .LOCK_NOT_GRANTED => return error.LockViolation,8848 .LOCK_NOT_GRANTED => return error.LockViolation,
8851 .ACCESS_DENIED => return error.AccessDenied,8849 .ACCESS_DENIED => return error.AccessDenied,