From ef99373c31bf515d9e5ab0b2749fb04771311c71 Mon Sep 17 00:00:00 2001 From: Feoramund <161657516+Feoramund@users.noreply.github.com> Date: Mon, 26 Aug 2024 00:58:32 -0400 Subject: [PATCH] Fix `pread` and `pwrite` on `os2` Windows The previous code was jumping ahead by the specified offset, instead of getting the current offset. --- core/os/os2/file_windows.odin | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/os/os2/file_windows.odin b/core/os/os2/file_windows.odin index 2f551c49a..56ac7aaae 100644 --- a/core/os/os2/file_windows.odin +++ b/core/os/os2/file_windows.odin @@ -354,7 +354,7 @@ _read_at :: proc(f: ^File_Impl, p: []byte, offset: i64) -> (n: i64, err: Error) buf = buf[:MAX_RW] } - curr_offset := _seek(f, offset, .Current) or_return + curr_offset := _seek(f, 0, .Current) or_return defer _seek(f, curr_offset, .Start) o := win32.OVERLAPPED{ @@ -423,7 +423,7 @@ _write_at :: proc(f: ^File_Impl, p: []byte, offset: i64) -> (n: i64, err: Error) buf = buf[:MAX_RW] } - curr_offset := _seek(f, offset, .Current) or_return + curr_offset := _seek(f, 0, .Current) or_return defer _seek(f, curr_offset, .Start) o := win32.OVERLAPPED{