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:
authorEric Blake <eblake@redhat.com>2009-07-22 06:17:12 +0400
committerEric Blake <eblake@redhat.com>2009-07-22 06:17:12 +0400
commitd6438f13d10acf192955b98b3f3a3fd5948f211e (patch)
treef912d00d60ceb871d488e6c8045d4bb88bc733d7 /newlib/libc
parentdc176ff60c5d8bb316d1f012c1ae542939648ceb (diff)
Avoid a fault from locking a closed standard file.
* libc/stdio/fflush.c (_fflush_r): Give up early if stream has been previously closed.
Diffstat (limited to 'newlib/libc')
-rw-r--r--newlib/libc/stdio/fflush.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/newlib/libc/stdio/fflush.c b/newlib/libc/stdio/fflush.c
index 218940dcf..bc208ec49 100644
--- a/newlib/libc/stdio/fflush.c
+++ b/newlib/libc/stdio/fflush.c
@@ -93,6 +93,9 @@ _DEFUN(_fflush_r, (ptr, fp),
CHECK_INIT (ptr, fp);
+ if (!fp->_flags)
+ return 0;
+
_flockfile (fp);
t = fp->_flags;