Skip to content

Commit

Permalink
Merge pull request #4091 from Feoramund/fix-darwin-os-open
Browse files Browse the repository at this point in the history
Check if file open-mode is `O_CREATE` on Darwin before forcing chmod
  • Loading branch information
Kelimion authored Aug 16, 2024
2 parents 14e2070 + a07878b commit 970dc7a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/os/os_darwin.odin
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ open :: proc(path: string, flags: int = O_RDWR, mode: int = 0) -> (handle: Handl
@INFO(Platin): this is only done because O_CREATE for some reason fails to apply mode
should not happen if the handle is a directory
*/
if mode != 0 && !isDir {
if flags & O_CREATE != 0 && mode != 0 && !isDir {
err = fchmod(handle, cast(u16)mode)
if err != nil {
_unix_close(handle)
Expand Down

0 comments on commit 970dc7a

Please sign in to comment.