mirror of
https://github.com/apple/swift-system
synced 2026-11-25 04:47:55 +00:00
[Windows] Fix a problem with opening files read only.
`_O_RDONLY` is zero, so we can't test for it by AND-ing.
This commit is contained in:
1 parent
f1d7eb52c6
commit
53471ce33b
1 file changed
+6
-5
@@ -621,14 +621,15 @@ fileprivate struct DecodedOpenFlags {
|
||||
}
|
||||
|
||||
dwDesiredAccess = 0
|
||||
if (oflag & _O_RDONLY) != 0 {
|
||||
switch (oflag & (_O_RDONLY|_O_WRONLY|_O_RDWR)) {
|
||||
case _O_RDONLY:
|
||||
dwDesiredAccess |= DWORD(GENERIC_READ)
|
||||
}
|
||||
if (oflag & _O_WRONLY) != 0 {
|
||||
case _O_WRONLY:
|
||||
dwDesiredAccess |= DWORD(GENERIC_WRITE)
|
||||
}
|
||||
if (oflag & _O_RDWR) != 0 {
|
||||
case _O_RDWR:
|
||||
dwDesiredAccess |= DWORD(GENERIC_READ) | DWORD(GENERIC_WRITE)
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
bInheritHandle = WindowsBool((oflag & _O_NOINHERIT) == 0)
|
||||
|
||||
Reference in new issue
Block a user