Fix reading from /sys/ pseudo fx

This commit is contained in:
Jeroen van Rijn
2023-10-26 14:30:04 +02:00
parent 8e4bdcfb98
commit 962d599996
+2 -2
View File
@@ -63,8 +63,8 @@ read_at_least :: proc(fd: Handle, buf: []byte, min: int) -> (n: int, err: Errno)
if len(buf) < min { if len(buf) < min {
return 0, -1 return 0, -1
} }
for n < min && err == 0 { nn := max(int)
nn: int for nn > 0 && n < min && err == 0 {
nn, err = read(fd, buf[n:]) nn, err = read(fd, buf[n:])
n += nn n += nn
} }