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][BZ #12685] Allow arbitrary number of modes in fopen.


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
 


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