[PATCH v5][BZ #12685] Allow arbitrary number of modes in fopen.

Ondřej Bílka neleai@seznam.cz
Sat Jun 1 11:09:00 GMT 2013


On Wed, May 29, 2013 at 03:19:58PM -0700, Roland McGrath wrote:

> > +  /* Test if fopen mode e that sets FD_CLOEXEC is recognized.  */
> > +  stream = fopen ("/dev/null", "rccccccccccccccccccccce");
> > +
> > +  if ((fcntl (fileno (stream), F_GETFD) & FD_CLOEXEC) == 0)
> 
> This relies on lower-level stuff that really isn't necessary to test this.
> Instead, use a mode that ends with "+" and then attempt a call like putc.
> 
OK, but it also depend on nonstandard stuff as manpage says:

The argument mode points to a string beginning with one of the  follow‐
ing sequences (possibly followed by additional characters, as described
below):



More information about the Libc-alpha mailing list