diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2022-04-05 12:29:20 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-05 12:29:20 +0100 |
| commit | a4d2ff05a945a4e78f1f04fb2ac1f7d6d2ccba34 (patch) | |
| tree | 36427a00a9341880474b120714261f5c2836555a | |
| parent | 48012ec73cf52575f92d7728b6229c96a2e0859f (diff) | |
| parent | e80bee68673c4e50640d55d8fe71a09e8d4bc2a1 (diff) | |
Merge pull request #1688 from bkrypt/fix_file_windows_open_create_append_order
os/file_windows: Fix "create or append" file open behavior
| -rw-r--r-- | core/os/file_windows.odin | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/core/os/file_windows.odin b/core/os/file_windows.odin index 61e9e0925..a9f78070f 100644 --- a/core/os/file_windows.odin +++ b/core/os/file_windows.odin @@ -20,13 +20,13 @@ open :: proc(path: string, mode: int = O_RDONLY, perm: int = 0) -> (Handle, Errn case O_RDWR: access = win32.FILE_GENERIC_READ | win32.FILE_GENERIC_WRITE } + if mode&O_CREATE != 0 { + access |= win32.FILE_GENERIC_WRITE + } if mode&O_APPEND != 0 { access &~= win32.FILE_GENERIC_WRITE access |= win32.FILE_APPEND_DATA } - if mode&O_CREATE != 0 { - access |= win32.FILE_GENERIC_WRITE - } share_mode := win32.FILE_SHARE_READ|win32.FILE_SHARE_WRITE sa: ^win32.SECURITY_ATTRIBUTES = nil |