From ded99a2cabaf7bae461f22082268b544b20ba353 Mon Sep 17 00:00:00 2001 From: Ginger Bill Date: Fri, 12 May 2017 10:29:55 +0100 Subject: [PATCH] Fix issue with `os.file_size` on *nix --- core/os_linux.odin | 4 ++-- core/os_x.odin | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/os_linux.odin b/core/os_linux.odin index 90250a625..99eea1a47 100644 --- a/core/os_linux.odin +++ b/core/os_linux.odin @@ -179,11 +179,11 @@ seek :: proc(fd: Handle, offset: i64, whence: int) -> (i64, Errno) { return res, 0; } -file_size :: proc(fd: Handle) -> (i64, bool) { +file_size :: proc(fd: Handle) -> (i64, Errno) { prev, _ := seek(fd, 0, SEEK_CUR); size, err := seek(fd, 0, SEEK_END); seek(fd, prev, SEEK_SET); - return size, err != 0; + return size, err; } diff --git a/core/os_x.odin b/core/os_x.odin index ecbed3f27..fcc39c218 100644 --- a/core/os_x.odin +++ b/core/os_x.odin @@ -196,11 +196,11 @@ seek :: proc(fd: Handle, offset: AddressSize, whence: int) -> (AddressSize, Errn return final_offset, 0; } -file_size :: proc(fd: Handle) -> (i64, bool) { +file_size :: proc(fd: Handle) -> (i64, Errno) { prev, _ := seek(fd, 0, SEEK_CUR); size, err := seek(fd, 0, SEEK_END); seek(fd, prev, SEEK_SET); - return size, err != 0; + return size, err; }