This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Implementation of C11 Bounds-checking interfaces
- From: Ulrich Bayer <ubayer at sba-research dot org>
- To: Rich Felker <dalias at aerifal dot cx>
- Cc: <libc-alpha at sourceware dot org>
- Date: Thu, 1 Nov 2012 21:31:13 +0100
- Subject: Re: Implementation of C11 Bounds-checking interfaces
- References: <509132DA.9060503@sba-research.org> <CAE2sS1iRjP4FakjCCJ4tRA90UdUY-sd+eU9h27h_Hm89r7_VDA@mail.gmail.com> <Pine.LNX.4.64.1210311714370.7365@digraph.polyomino.org.uk>
>
> Some more notes on behavior/conformance:
>
> freopen_s: It is not conformant to call fclose and then fopen_s.
> freopen is required to return the argument passed to it on success,
> not a new FILE pointer. I think wrapping freopen would work just fine
> and would also handle the case where the filename argument is NULL.
>
> gets_s: Very slow and does not perform the necessary locking to make
> the whole operation atomic. You should just call fgets and then remove
> the trailing newline if gets_s is supposed to behave like gets and do
> that.
>
> Rich
Thanks! I will look at this and try to change the implementation
accordingly.
Ulrich