From 08146e5adbceb673cc2c6c4adee05ba37f709095 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Fri, 13 Jul 2007 20:37:53 +0000 Subject: Fix fflush issues. * libc/stdio/fflush.c (_fflush_r): New function. (fflush): Fix reentrancy and large offset behavior. * libc/include/stdio.h (_fflush_r): Add prototype. * libc/stdio/fclose.c (_fclose_r): All fflush callers changed. * libc/stdio/freopen.c (_freopen_r): Likewise. * libc/stdio/fseek.c (_fseek_r): Likewise. * libc/stdio/ftell.c (_ftell_r): Likewise. * libc/stdio/fvwrite.c (__sfvwrite_r): Likewise. * libc/stdio/refill.c (__srefill_r): Likewise. * libc/stdio/setvbuf.c (setvbuf): Likewise. * libc/stdio/ungetc.c (_ungetc_r): Likewise. * libc/stdio/vfprintf.c (__sbprintf): Likewise. * libc/stdio/wbuf.c (__swbuf_r): Likewise. * libc/stdio64/freopen64.c (_freopen64_r): Likewise. * libc/stdio64/fseeko64.c (_fseeko64_r): Likewise. Defer to 32-bit version if not large file. * libc/stdio64/ftello64.c (_ftello64_r): Likewise. * libc/stdio64/tmpfile64.c (_tmpfile64_r): Avoid compile warning. --- newlib/libc/stdio/vfprintf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'newlib/libc/stdio/vfprintf.c') diff --git a/newlib/libc/stdio/vfprintf.c b/newlib/libc/stdio/vfprintf.c index 0c1a47bb6..5bbd7594f 100644 --- a/newlib/libc/stdio/vfprintf.c +++ b/newlib/libc/stdio/vfprintf.c @@ -212,7 +212,7 @@ _DEFUN(__sbprintf, (rptr, fp, fmt, ap), /* do the work, then copy any error status */ ret = _VFPRINTF_R (rptr, &fake, fmt, ap); - if (ret >= 0 && fflush(&fake)) + if (ret >= 0 && _fflush_r (rptr, &fake)) ret = EOF; if (fake._flags & __SERR) fp->_flags |= __SERR; -- cgit v1.2.3