From 962d59999639edfe64fb15c5b4587993c4e4a5ec Mon Sep 17 00:00:00 2001 From: Jeroen van Rijn Date: Thu, 26 Oct 2023 14:30:04 +0200 Subject: [PATCH] Fix reading from `/sys/` pseudo fx --- core/os/os.odin | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/os/os.odin b/core/os/os.odin index b71ea261e..15864e47e 100644 --- a/core/os/os.odin +++ b/core/os/os.odin @@ -63,8 +63,8 @@ read_at_least :: proc(fd: Handle, buf: []byte, min: int) -> (n: int, err: Errno) if len(buf) < min { return 0, -1 } - for n < min && err == 0 { - nn: int + nn := max(int) + for nn > 0 && n < min && err == 0 { nn, err = read(fd, buf[n:]) n += nn }