fix(os2): check for 0 bytes read and return EOF

This commit is contained in:
IllusionMan1212
2024-06-18 17:03:54 +02:00
parent d0dbe9a1bd
commit c987b964c8
+6
View File
@@ -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)