commit 8f8aa8346a8babe43fb85d7033db2a329d602366 (tree)
parent 4dd7fe90a2b541a44aafc3a9596445387a3aed49
Author: Andrew Kelley <andrew@ziglang.org>
Date: Thu, 29 Jan 2026 13:31:44 -0800
std.Io.Threaded: ntReadFileResult handles EOF + bytes available
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/std/Io/Threaded.zig b/lib/std/Io/Threaded.zig
@@ -8709,8 +8709,10 @@ fn ntReadFileResult(io_status_block: *const windows.IO_STATUS_BLOCK) !usize {
.PENDING => unreachable,
.CANCELLED => unreachable,
.SUCCESS => return io_status_block.Information,
- .END_OF_FILE => return error.EndOfStream,
- .PIPE_BROKEN => return error.EndOfStream,
+ .END_OF_FILE, .PIPE_BROKEN => {
+ if (io_status_block.Information == 0) return error.EndOfStream;
+ return io_status_block.Information;
+ },
.INVALID_DEVICE_REQUEST => return error.IsDir,
.LOCK_NOT_GRANTED => return error.LockViolation,
.ACCESS_DENIED => return error.AccessDenied,