Merge pull request #3776 from IllusionMan1212/os2-read-fix

fix(os2): check for 0 bytes read and return EOF
This commit is contained in:
gingerBill
2024-06-20 15:37:41 +01:00
committed by GitHub
+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)