mirror of
https://github.com/odin-lang/Odin.git
synced 2026-02-14 07:13:14 +00:00
Report Invalid_Whence in os2 POSIX seek
This commit is contained in:
@@ -419,9 +419,22 @@ _file_stream_proc :: proc(stream_data: rawptr, mode: io.Stream_Mode, p: []byte,
|
||||
#assert(int(posix.Whence.CUR) == int(io.Seek_From.Current))
|
||||
#assert(int(posix.Whence.END) == int(io.Seek_From.End))
|
||||
|
||||
switch whence {
|
||||
case .Start, .Current, .End:
|
||||
break
|
||||
case:
|
||||
err = .Invalid_Whence
|
||||
return
|
||||
}
|
||||
|
||||
n = i64(posix.lseek(fd, posix.off_t(offset), posix.Whence(whence)))
|
||||
if n < 0 {
|
||||
err = .Unknown
|
||||
#partial switch posix.get_errno() {
|
||||
case .EINVAL:
|
||||
err = .Invalid_Offset
|
||||
case:
|
||||
err = .Unknown
|
||||
}
|
||||
}
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user