[PATCH] CHECK_INIT() before _flockfile() for scanf/fscanf
Corinna Vinschen
vinschen@redhat.com
Fri Jul 15 17:21:00 GMT 2011
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
More information about the Newlib
mailing list