3 ms·
True, but you have to dig a lot to find any details. The above code is easy to write from a good man page (OpenBSD's, in this case.) (Also, open(2) has all the
by JoachimSchipper 15y ago
True, but you have to dig a lot to find any details. The above code is easy to write from a good man page (OpenBSD's, in this case.)
(Also, open(2) has all these options for a reason; think symlink races. Python's open() is not sufficient.)
- sausagefeet 15y agoNote, open is not part of C. A better comparison would be fopen which, according to the C99 draft I have, just returns NULL on failure.
- JoachimSchipper 15y agoYou're technically correct, but that's not the "C" being discussed in this article. Also, fopen(3) on OpenBSD does document values errno after failure (by reference to the malloc(3) and open(2) man pages), and I expect that any reasonable system does likewise.