Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2012-06-05 20:17:16 +0400
committerCorinna Vinschen <corinna@vinschen.de>2012-06-05 20:17:16 +0400
commit8336af85e9816ea57389252331960f625ed33975 (patch)
tree19fab80afff238bea1aaadcd27f523f4933d64f6 /newlib/libc/stdio/findfp.c
parentcd69beda6725d2437a333d82417d58078f081c8f (diff)
* libc/stdio/findfp.c (__sinit): Avoid infinite recursion on
_REENT_SMALL targets. Add comment to explain.
Diffstat (limited to 'newlib/libc/stdio/findfp.c')
-rw-r--r--newlib/libc/stdio/findfp.c5
1 files changed, 5 insertions, 0 deletions
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);