diff options
| author | Platin21 <arminmops@icloud.com> | 2022-12-22 01:26:06 +0100 |
|---|---|---|
| committer | Platin21 <arminmops@icloud.com> | 2022-12-22 01:26:06 +0100 |
| commit | fb562ea708b37ccfbbdba93afbbae5f1074f836b (patch) | |
| tree | ee3111ea78c56a646a4aaf1fe14b95e8697837bb | |
| parent | cdeeeafc3fbb1044abc872157d4354275f215c3d (diff) | |
Adds error casting from last error if open fails
| -rw-r--r-- | core/os/os_darwin.odin | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/core/os/os_darwin.odin b/core/os/os_darwin.odin index 3c69740c2..c5addb2bb 100644 --- a/core/os/os_darwin.odin +++ b/core/os/os_darwin.odin @@ -345,16 +345,15 @@ open :: proc(path: string, flags: int = O_RDWR, mode: int = 0) -> (Handle, Errno cstr := strings.clone_to_cstring(path, context.temp_allocator) handle := _unix_open(cstr, i32(flags), u16(mode)) if handle == -1 { - return INVALID_HANDLE, 1 + return INVALID_HANDLE, cast(Errno)get_last_error() } when ODIN_OS == .Darwin && ODIN_ARCH == .arm64 { - if mode != 0 { if mode != 0 && !is_dir_handle(handle) { err := fchmod(handle, cast(u16)mode) if err != 0 { _unix_close(handle) - return INVALID_HANDLE, 1 + return INVALID_HANDLE, cast(Errno)err } } } |