diff options
author | Eric Blake <eblake@redhat.com> | 2007-07-13 20:37:53 +0000 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2007-07-13 20:37:53 +0000 |
commit | 08146e5adbceb673cc2c6c4adee05ba37f709095 (patch) | |
tree | 2bda91075f62fa6b54750cca0346838ebf1a9f28 /newlib/libc/stdio/fvwrite.c | |
parent | b71fb40215c79d607d8f24dc6af0c28d5ce9ccaf (diff) | |
download | newlib-08146e5adbceb673cc2c6c4adee05ba37f709095.zip newlib-08146e5adbceb673cc2c6c4adee05ba37f709095.tar.gz newlib-08146e5adbceb673cc2c6c4adee05ba37f709095.tar.bz2 |
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.
Diffstat (limited to 'newlib/libc/stdio/fvwrite.c')
-rw-r--r-- | newlib/libc/stdio/fvwrite.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/newlib/libc/stdio/fvwrite.c b/newlib/libc/stdio/fvwrite.c index 75fc834..d3878dc 100644 --- a/newlib/libc/stdio/fvwrite.c +++ b/newlib/libc/stdio/fvwrite.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1990, 2006, 2007 The Regents of the University of California. + * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms are permitted @@ -185,7 +185,7 @@ _DEFUN(__sfvwrite_r, (ptr, fp, uio), COPY (w); /* fp->_w -= w; *//* unneeded */ fp->_p += w; - if (fflush (fp)) + if (_fflush_r (ptr, fp)) goto err; } else if (len >= (w = fp->_bf._size)) @@ -235,7 +235,7 @@ _DEFUN(__sfvwrite_r, (ptr, fp, uio), COPY (w); /* fp->_w -= w; */ fp->_p += w; - if (fflush (fp)) + if (_fflush_r (ptr, fp)) goto err; } else if (s >= (w = fp->_bf._size)) @@ -254,7 +254,7 @@ _DEFUN(__sfvwrite_r, (ptr, fp, uio), if ((nldist -= w) == 0) { /* copied the newline: flush and forget */ - if (fflush (fp)) + if (_fflush_r (ptr, fp)) goto err; nlknown = 0; } |