|
@@ -1723,10 +1723,12 @@ void _stdio_term(void)
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
+#ifdef __STDIO_BUFFERS
|
|
|
|
|
|
|
|
|
|
|
|
fflush(NULL);
|
|
|
+#endif
|
|
|
|
|
|
|
|
|
* don't use fclose() because that pulls in free and malloc. Also,
|
|
@@ -2031,9 +2033,15 @@ int fflush_unlocked(register FILE *stream)
|
|
|
|
|
|
#else
|
|
|
|
|
|
- __stdio_validate_FILE(stream);
|
|
|
+#ifndef NDEBUG
|
|
|
+ if ((stream != NULL) && (stream != (FILE *) &_stdio_openlist)) {
|
|
|
+ __stdio_validate_FILE(stream);
|
|
|
+ }
|
|
|
+#endif
|
|
|
+
|
|
|
|
|
|
- return (stream->modeflags & (__FLAG_READONLY|__FLAG_READING)
|
|
|
+ return ((stream != NULL)
|
|
|
+ && (stream->modeflags & (__FLAG_READONLY|__FLAG_READING))
|
|
|
? ((stream->modeflags |= __FLAG_ERROR), __set_errno(EBADF), EOF)
|
|
|
: 0 );
|
|
|
|