From c987b964c81090a0d4a11ef530db3f9037ab5fc6 Mon Sep 17 00:00:00 2001 From: IllusionMan1212 Date: Tue, 18 Jun 2024 17:03:54 +0200 Subject: [PATCH] fix(os2): check for 0 bytes read and return EOF --- core/os/os2/file_linux.odin | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/os/os2/file_linux.odin b/core/os/os2/file_linux.odin index 3843c1105..8f298be88 100644 --- a/core/os/os2/file_linux.odin +++ b/core/os/os2/file_linux.odin @@ -121,6 +121,9 @@ _read :: proc(f: ^File, p: []byte) -> (i64, Error) { if n < 0 { return -1, _get_platform_error(n) } + if n == 0 { + return 0, .EOF + } return i64(n), nil } @@ -135,6 +138,9 @@ _read_at :: proc(f: ^File, p: []byte, offset: i64) -> (n: i64, err: Error) { if m < 0 { return -1, _get_platform_error(m) } + if m == 0 { + return 0, .EOF + } n += i64(m) b = b[m:] offset += i64(m)