summaryrefslogtreecommitdiffstats
path: root/newlib/libc/stdio/fwalk.c
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/stdio/fwalk.c')
-rw-r--r--newlib/libc/stdio/fwalk.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/newlib/libc/stdio/fwalk.c b/newlib/libc/stdio/fwalk.c
index 516283466..4d37499dd 100644
--- a/newlib/libc/stdio/fwalk.c
+++ b/newlib/libc/stdio/fwalk.c
@@ -35,9 +35,17 @@ _fwalk (ptr, function)
register int n, ret = 0;
register struct _glue *g;
+ /* Must traverse given list for std streams. */
for (g = &ptr->__sglue; g != NULL; g = g->_next)
for (fp = g->_iobs, n = g->_niobs; --n >= 0; fp++)
if (fp->_flags != 0)
ret |= (*function) (fp);
+
+ /* Must traverse global list for all other streams. */
+ for (g = &_GLOBAL_REENT->__sglue; g != NULL; g = g->_next)
+ for (fp = g->_iobs, n = g->_niobs; --n >= 0; fp++)
+ if (fp->_flags != 0)
+ ret |= (*function) (fp);
+
return ret;
}