From d6438f13d10acf192955b98b3f3a3fd5948f211e Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Wed, 22 Jul 2009 02:17:12 +0000 Subject: Avoid a fault from locking a closed standard file. * libc/stdio/fflush.c (_fflush_r): Give up early if stream has been previously closed. --- newlib/libc/stdio/fflush.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'newlib/libc/stdio/fflush.c') diff --git a/newlib/libc/stdio/fflush.c b/newlib/libc/stdio/fflush.c index 218940d..bc208ec 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; -- cgit v1.1