This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: [PATCH] CHECK_INIT() before _flockfile() for scanf/fscanf
- From: Corinna Vinschen <vinschen at redhat dot com>
- To: newlib at sourceware dot org
- Date: Fri, 15 Jul 2011 10:05:00 +0200
- Subject: Re: [PATCH] CHECK_INIT() before _flockfile() for scanf/fscanf
- References: <4E1F9466.9080606@crhc.illinois.edu>
- Reply-to: newlib at sourceware dot org
On Jul 14 20:14, Matt Johnson wrote:
> Hi all,
> I noticed a mailing list thread and commit from 2005 here
> http://sourceware.org/ml/newlib/2005/msg00088.html where some stdio
> functions were calling _flockfile() on a FILE * before initializing
> it. I think scanf/fscanf may have been missed by this initial
> patch; in the version of newlib I have (latest release), scanf() and
> fscanf() call directly into __svfscanf_r(), rather than going
> through the intermediate _vfscanf_r(), which contains the
> CHECK_INIT() call. I was having problems where, if my program calls
> scanf() or fscanf(stdin, ...) before any *printf() calls, stdin got
> permanently locked up. Here's a patch that fixed things for me:
Thanks, I applied your patch, together with the equivalent change to
fwscanf and wscanf.
Corinna
--
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat