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

This commit is contained in:
Andrew Kelley
2026-01-30 12:27:27 -08:00
parent 2674acdb77
commit 62c97b745d
+3 -5
View File
@@ -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,