diff options
| author | Feoramund <161657516+Feoramund@users.noreply.github.com> | 2024-08-22 17:32:30 -0400 |
|---|---|---|
| committer | Laytan <laytanlaats@hotmail.com> | 2024-08-28 19:53:20 +0200 |
| commit | 7683c1f4bb284e54d668b7a63a7204c7df30d5d6 (patch) | |
| tree | 306d3aa260c03e20ebdaf0fbe0a521c4694e087f | |
| parent | ef2cd9d97f62ec3749573f97b7a34d4a24368504 (diff) | |
Report `Invalid_Whence` in `os2` POSIX seek
| -rw-r--r-- | core/os/os2/file_posix.odin | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/core/os/os2/file_posix.odin b/core/os/os2/file_posix.odin index 26bcb111c..dae85d224 100644 --- a/core/os/os2/file_posix.odin +++ b/core/os/os2/file_posix.odin @@ -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 |