Hi all,
I've found weird issue with O_RDWR access flag. When you want check
if file is opened for read-only or read-write access you can write
code like:
if (mode & O_WRONLY)
die();
That piece of code should fail only if file is opened with write-only
access mode.
Main problem is that GNU/Hurd has this O_RDWR flag definition:
#define O_RDWR (O_RDONLY|O_WRONLY)
It looks like bad for me because code written above fails even if file
is opened with read-write access.
Yes, you could use condition like
if (!((mode & O_RDWR) || (mode & O_RDONLY)))
die();
but it is really not intuitive and will mysteriously break many
programs.
I think O_RDWR definition should be revised, isn't it? That definition
is part of libc but change will affect whole OS.
Regards, Adam
--
Adam Tkac