Browse Source

Merge pull request #4091 from Feoramund/fix-darwin-os-open

Check if file open-mode is `O_CREATE` on Darwin before forcing chmod
Jeroen van Rijn 1 year ago
parent
commit
970dc7a1f2
1 changed files with 1 additions and 1 deletions
  1. 1 1
      core/os/os_darwin.odin

+ 1 - 1
core/os/os_darwin.odin

@@ -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)