[Windows] Add a comment to explain the O_RDONLY/O_WRONLY/O_RDWR logic.

The values of these flags on Windows do not overlap, and more
particularly, `O_RDONLY` is actually zero on Windows, which means we
cannot test for it by AND-ing.
This commit is contained in:
Alastair Houghton committed 2024-05-14 14:42:57 +01:00
1 parent abc0a6d26f
commit 082adfe732
1 file changed
+3
@@ -620,6 +620,9 @@ fileprivate struct DecodedOpenFlags {
dwCreationDisposition = DWORD(OPEN_EXISTING)
}
// The _O_RDONLY, _O_WRONLY and _O_RDWR flags are non-overlapping
// on Windows; in particular, _O_RDONLY is zero, which means we can't
// test for it by AND-ing.
dwDesiredAccess = 0
switch (oflag & (_O_RDONLY|_O_WRONLY|_O_RDWR)) {
case _O_RDONLY: