Using O_RDWR vs O_RDONLY | O_WRONLY

O_RDONLY | O_WRONLY (at least on my Linux machine) is not the same thing as O_RDWR.

#define O_RDONLY         00
#define O_WRONLY         01
#define O_RDWR           02

The fact that it works seems like a bug/feature/coincidence rather than “it works because it should work that way”.

Leave a Comment