mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Check if file open-mode is O_CREATE on Darwin before forcing chmod
Fixes #4087
This commit is contained in:
@@ -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
|
@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
|
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)
|
err = fchmod(handle, cast(u16)mode)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
_unix_close(handle)
|
_unix_close(handle)
|
||||||
|
|||||||
Reference in New Issue
Block a user