The following code in Gnulib's openat function: http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=lib/openat.c;h=d2c84e8f80489201be2a7198bb979fe4be6f9ecb;hb=HEAD#l103
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: https://www.gnu.org/software/libc/manual/html_node/Access-Modes.html#Access-Modes 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. Dan
