diff options
author | Alex Brainman <alex.brainman@gmail.com> | 2010-04-13 22:30:41 -0700 |
---|---|---|
committer | Alex Brainman <alex.brainman@gmail.com> | 2010-04-13 22:30:41 -0700 |
commit | 403065e079898cb5e87298b50c27e41cfe7a269c (patch) | |
tree | f2712923df57efc24bab389fa93e4e3440851b5f /src/pkg/syscall/syscall_mingw.go | |
parent | 0b200c5a56b9f8b528d20326a57195f46c5b668b (diff) | |
download | golang-403065e079898cb5e87298b50c27e41cfe7a269c.tar.gz |
os, syscall: mingw bug fixes
R=rsc
CC=golang-dev
http://codereview.appspot.com/815044
Committer: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/pkg/syscall/syscall_mingw.go')
-rw-r--r-- | src/pkg/syscall/syscall_mingw.go | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/pkg/syscall/syscall_mingw.go b/src/pkg/syscall/syscall_mingw.go index c3f8b9fb7..99f649e4f 100644 --- a/src/pkg/syscall/syscall_mingw.go +++ b/src/pkg/syscall/syscall_mingw.go @@ -132,21 +132,19 @@ func Open(path string, mode int, perm int) (fd int, errno int) { if len(path) == 0 { return -1, ERROR_FILE_NOT_FOUND } - var access, sharemode uint32 - switch { - case mode&O_CREAT != 0: - access = GENERIC_READ | GENERIC_WRITE - sharemode = 0 - case mode&O_RDWR == O_RDONLY: + var access uint32 + switch mode & (O_RDONLY | O_WRONLY | O_RDWR) { + case O_RDONLY: access = GENERIC_READ - sharemode = FILE_SHARE_READ - case mode&O_RDWR == O_WRONLY: + case O_WRONLY: access = GENERIC_WRITE - sharemode = FILE_SHARE_READ - case mode&O_RDWR == O_RDWR: + case O_RDWR: access = GENERIC_READ | GENERIC_WRITE - sharemode = FILE_SHARE_READ | FILE_SHARE_WRITE } + if mode&O_CREAT != 0 { + access |= GENERIC_WRITE + } + sharemode := uint32(FILE_SHARE_READ | FILE_SHARE_WRITE) var createmode uint32 switch { case mode&O_CREAT != 0: |