diff options
| author | gingerBill <bill@gingerbill.org> | 2022-02-19 15:45:08 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2022-02-19 15:45:08 +0000 |
| commit | 31c79454449c7f033805494e26dedb49bafb1e46 (patch) | |
| tree | a4c766f8a5cb0ccecce7df15a45617e7cad2c169 | |
| parent | 276e014d180dc571571cab341dbadadf2cf07594 (diff) | |
| parent | 27f206784cde592e3cdbe41cc42814c563eca252 (diff) | |
Merge branch 'master' of https://github.com/odin-lang/Odin
| -rw-r--r-- | core/os/os_linux.odin | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/core/os/os_linux.odin b/core/os/os_linux.odin index 140b84d8a..4edfa46da 100644 --- a/core/os/os_linux.odin +++ b/core/os/os_linux.odin @@ -501,11 +501,13 @@ seek :: proc(fd: Handle, offset: i64, whence: int) -> (i64, Errno) { } file_size :: proc(fd: Handle) -> (i64, Errno) { - s, err := _fstat(fd) - if err != ERROR_NONE { - return 0, err - } - return max(s.size, 0), ERROR_NONE + // deliberately uninitialized; the syscall fills this buffer for us + s: OS_Stat = --- + result := _unix_fstat(fd, &s) + if result < 0 { + return 0, _get_errno(result) + } + return max(s.size, 0), ERROR_NONE } rename :: proc(old_path, new_path: string) -> Errno { |