diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2012-06-05 16:17:16 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2012-06-05 16:17:16 +0000 |
commit | 8336af85e9816ea57389252331960f625ed33975 (patch) | |
tree | 19fab80afff238bea1aaadcd27f523f4933d64f6 | |
parent | cd69beda6725d2437a333d82417d58078f081c8f (diff) | |
download | cygnal-8336af85e9816ea57389252331960f625ed33975.tar.gz cygnal-8336af85e9816ea57389252331960f625ed33975.tar.bz2 cygnal-8336af85e9816ea57389252331960f625ed33975.zip |
* libc/stdio/findfp.c (__sinit): Avoid infinite recursion on
_REENT_SMALL targets. Add comment to explain.
-rw-r--r-- | newlib/ChangeLog | 5 | ||||
-rw-r--r-- | newlib/libc/stdio/findfp.c | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 935daa5b5..d5224cd2b 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -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 diff --git a/newlib/libc/stdio/findfp.c b/newlib/libc/stdio/findfp.c index e39660cd4..0beb1e5b0 100644 --- a/newlib/libc/stdio/findfp.c +++ b/newlib/libc/stdio/findfp.c @@ -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); |