diff options
Diffstat (limited to 'src/syscall/syscall_windows.go')
| -rw-r--r-- | src/syscall/syscall_windows.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/syscall/syscall_windows.go b/src/syscall/syscall_windows.go index db1f4f2ba4..67a71dfc76 100644 --- a/src/syscall/syscall_windows.go +++ b/src/syscall/syscall_windows.go @@ -362,8 +362,12 @@ func Open(name string, flag int, perm uint32) (fd Handle, err error) { access |= GENERIC_WRITE } if flag&O_APPEND != 0 { - access &^= GENERIC_WRITE access |= FILE_APPEND_DATA + // Remove GENERIC_WRITE access unless O_TRUNC is set, + // in which case we need it to truncate the file. + if flag&O_TRUNC == 0 { + access &^= GENERIC_WRITE + } } sharemode := uint32(FILE_SHARE_READ | FILE_SHARE_WRITE) var sa *SecurityAttributes |
