* libc/stdio/findfp.c (__sinit): Avoid infinite recursion on

_REENT_SMALL targets.  Add comment to explain.
This commit is contained in:
Corinna Vinschen 2012-06-05 16:17:16 +00:00
parent cd69beda67
commit 8336af85e9
2 changed files with 10 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2012-06-05 Corinna Vinschen <vinschen@redhat.com>
* libc/stdio/findfp.c (__sinit): Avoid infinite recursion on
_REENT_SMALL targets. Add comment to explain.
2012-05-31 Corinna Vinschen <vinschen@redhat.com>
* libc/stdio/local.h (_newlib_sfp_lock_exit): Fix typo in non-pthread

View File

@ -200,6 +200,11 @@ _DEFUN(__sinit, (s),
#else
s->__sglue._niobs = 0;
s->__sglue._iobs = NULL;
/* Avoid infinite recursion when calling __sfp for _GLOBAL_REENT. The
problem is that __sfp checks for _GLOBAL_REENT->__sdidinit and calls
__sinit if it's 0. */
if (s == _GLOBAL_REENT)
s->__sdidinit = 1;
s->_stdin = __sfp(s);
s->_stdout = __sfp(s);
s->_stderr = __sfp(s);