Thread (69 messages) flat view 69 messages, 4 authors, 2016-06-15

Re: [PATCH v4 01/44] wrapper: implement xopen()

From: Paul Tan <hidden>
Date: 2016-06-15 23:05:36

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help