summaryrefslogtreecommitdiff
path: root/src/stdio/fflush.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stdio/fflush.c')
-rw-r--r--src/stdio/fflush.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/stdio/fflush.c b/src/stdio/fflush.c
index e13f8979..cb5f49c6 100644
--- a/src/stdio/fflush.c
+++ b/src/stdio/fflush.c
@@ -27,6 +27,14 @@ int fflush(FILE *stream)
return 0;
}
+ if (!stream->write) {
+ UNDEFINED("attempt to fflush() an input stream");
+ }
+
+ if (stream->read && stream->operation == OP_INPUT) {
+ UNDEFINED("attempt to fflush() an update stream after input");
+ }
+
if (stream->bpos == 0) {
return 0;
}