CMake (Hurd): Define O_PATH to O_NORW. - #2498
Conversation
This is a noop because O_RW is 0 but O_NORW is the correct constant to open a file without read/write permissions.
|
Do you mean |
|
Yes, but inlike /* In GNU, read and write are bits (unlike BSD). */
#ifdef __USE_GNU
# define O_READ O_RDONLY /* Open for reading. */
# define O_WRITE O_WRONLY /* Open for writing. */
# define O_EXEC 0x0004 /* Open for execution. */
# define O_NORW 0 /* Open without R/W access. */
#endif
/* POSIX.1 standard names. */
#define O_RDONLY 0x0001 /* Open read-only. */
#define O_WRONLY 0x0002 /* Open write-only. */
#define O_RDWR (O_RDONLY|O_WRONLY) /* Open for reading and writing. */
#define O_ACCMODE O_RDWR /* Mask for file access modes. */I found out about O_NORW while browsing the debian package fir procps https://salsa.debian.org/debian/procps/-/blob/master/debian/patches/no-opath |
It's not accidentally. I still prefer |
Neither is O_PATH which is linux specific (it seems to also exists in the recent freebsd versions for linux compatibilty)
That is wrong in general but true on Hurd where On linux O_RDONLY is 0 so in the general open flags of 0 are not no r/w. https://sourceware.org/glibc/manual/latest/html_node/Access-Modes.html I put it there to make |
This is a noop because O_RW is 0 but O_NORW is the correct constant to open a file without read/write permissions.