This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v5][BZ #12685] Allow arbitrary number of modes in fopen.
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: Roland McGrath <roland at hack dot frob dot com>
- Cc: Andreas Schwab <schwab at suse dot de>, Carlos O'Donell <carlos at redhat dot com>, "Joseph S. Myers" <joseph at codesourcery dot com>, libc-alpha at sourceware dot org
- Date: Sat, 1 Jun 2013 13:07:42 +0200
- Subject: Re: [PATCH v5][BZ #12685] Allow arbitrary number of modes in fopen.
- References: <20130514121540 dot GA28892 at domone dot kolej dot mff dot cuni dot cz> <mvm38tpzqst dot fsf at hawking dot suse dot de> <20130514124257 dot GB18821 at domone dot kolej dot mff dot cuni dot cz> <mvmy5bhyb4h dot fsf at hawking dot suse dot de> <20130515091735 dot GA22641 at domone dot kolej dot mff dot cuni dot cz> <5193F463 dot 3040501 at redhat dot com> <20130520081258 dot GA32195 at domone dot kolej dot mff dot cuni dot cz> <mvmwqqspz50 dot fsf at hawking dot suse dot de> <20130524131333 dot GB10400 at domone dot kolej dot mff dot cuni dot cz> <20130529221958 dot B10CF2C07F at topped-with-meat dot com>
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):