This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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):


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]