Browse Source

Fix reading from `/sys/` pseudo fx

Jeroen van Rijn 1 year ago
parent
commit
962d599996
1 changed files with 2 additions and 2 deletions
  1. 2 2
      core/os/os.odin

+ 2 - 2
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 {
 	if len(buf) < min {
 		return 0, -1
 		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:])
 		nn, err = read(fd, buf[n:])
 		n += nn
 		n += nn
 	}
 	}