This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH][BZ #12685] Allow arbitrary number of modes in fopen.
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: Carlos O'Donell <carlos at redhat dot com>
- Cc: "Joseph S. Myers" <joseph at codesourcery dot com>, libc-alpha at sourceware dot org
- Date: Fri, 10 May 2013 12:33:32 +0200
- Subject: Re: [PATCH][BZ #12685] Allow arbitrary number of modes in fopen.
- References: <20130509152046 dot GA4242 at domone dot kolej dot mff dot cuni dot cz> <Pine dot LNX dot 4 dot 64 dot 1305091533180 dot 25142 at digraph dot polyomino dot org dot uk> <518BEFB2 dot 80304 at redhat dot com>
On Thu, May 09, 2013 at 02:49:22PM -0400, Carlos O'Donell wrote:
> On 05/09/2013 11:34 AM, Joseph S. Myers wrote:
> > On Thu, 9 May 2013, Ondrej Bilka wrote:
> >
> >> Hi,
> >>
> >> I implemented Michael Kerrisk's suggestion from
> >> http://sourceware.org/bugzilla/show_bug.cgi?id=12685
> >> to read mode until NULL or comma (for ,ccs=) is reached.
> >>
> >> OK to commit?
> >>
> >> Ondra
> >>
> >> * libio/fileops.c (_IO_new_file_fopen): Allow arbitrary number of modes.
> >> * libio/iofdopen.c (_IO_new_fdopen): Likewise.
> >
> > I think this should add testcases (for both functions) that a mode late in
> > a long string is properly handled.
> >
>
> I agree we need test cases for this to prevent regression.
>
How should I test it? It looks that only x has directly testable
behaviour.
>From manpage:
c (since glibc 2.3.3)
Do not make the open operation, or subsequent read and
write operations, thread cancellation points. This flag is ignored for
fdopen().
e (since glibc 2.7)
Open the file with the O_CLOEXEC flag. See open(2) for
more information. This flag is ignored for fdopen().
m (since glibc 2.3)
Attempt to access the file using mmap(2), rather than I/O
system calls (read(2), write(2)). Currently, use of mmap(2) is only
attempted for a file opened for reading.
x Open the file exclusively (like the O_EXCL flag of
open(2)). If the file already exists, fopen() fails, and sets errno to
EEXIST.
This flag is ignored for fdopen().
In addition to the above characters, fopen() and freopen()
support the following syntax in mode:
,ccs=string