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.
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1990, 2006, 2007 The Regents of the University of California.
|
||||
* Copyright (c) 1990, 2007 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
@ -124,7 +124,7 @@ _DEFUN(_freopen_r, (ptr, file, mode, fp),
|
||||
else
|
||||
{
|
||||
if (fp->_flags & __SWR)
|
||||
fflush (fp);
|
||||
_fflush_r (ptr, fp);
|
||||
/*
|
||||
* If close is NULL, closing is a no-op, hence pointless.
|
||||
* If file is NULL, the file should not be closed.
|
||||
|
Reference in New Issue
Block a user