Fix broken cases of Seek usage in _file_stream_proc

Handles `EINVAL`, among other fixes.
This commit is contained in:
Feoramund
2024-08-28 19:53:20 +02:00
committed by Laytan
parent e83b982afe
commit 1ced76cdd1
4 changed files with 15 additions and 0 deletions
+8
View File
@@ -47,6 +47,14 @@ _file_stream_proc :: proc(stream_data: rawptr, mode: io.Stream_Mode, p: []byte,
}
case .Seek:
n, os_err = seek(fd, offset, int(whence))
if os_err != nil {
switch whence {
case .Start, .Current, .End:
return 0, .Invalid_Offset
case:
return 0, .Invalid_Whence
}
}
case .Size:
n, os_err = file_size(fd)
case .Destroy: