On Mon, Jun 29, 2015 at 12:48 PM, Torsten Bögershausen [off-list ref] wrote:
- Having xopen() with 2 or 3 parameter is good, but the current may need
some tweaks for better portability:
int xopen(const char *path, int oflag, ...)
{
mode_t mode = 0;
if (oflag & O_CREAT) {
va_list ap;
va_start(ap, oflag);
mode = va_arg(ap, int);
va_end(ap);
}
See e.g.
<http://blitiri.com.ar/git/r/libfiu/c/37f6a98110e3bb59bbb4971241baa3a385c3f724/>
why va_arg(ap, int) should be used:
Ah OK. I've learned about yet another dark corner of C :-).
Thanks,
Paul