tests for a file mode being writable with the following _expression_:
> if (flags & (O_CREAT | O_WRONLY | O_RDWR))
However, this can erroneously return true on systems where O_RDWR shares bits with R_RDONLY. POSIX doesn't guarantee anything about the values of O_RDWR and O_RDONLY, and GNU Hurd is an example of a system where O_RDWR and O_RDONLY do share bits:
That said, the code in question is only used on platforms where `OPEN_TRAILING_SLASH_BUG` is defined, and I don't have any ready examples of relevant platforms with both `OPEN_TRAILING_SLASH_BUG` defined and with `O_RDWR` sharing bits with `O_RDONLY`. However, such a platform is a theoretical possibility.