summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2024-05-29 16:58:53 -0400
committerJakob Kaivo <jkk@ung.org>2024-05-29 16:58:53 -0400
commit4dbffd990276fc6b9a3ffcca4a3c6686cc60ef4c (patch)
tree98552b7ea85a819fe63680afb87c2b5a943c0e05 /src
parentca806410c73085644116fa2979eaf3d5f3cbd35f (diff)
only attempt to flush streams that can be flushed when parameter is NULL
Diffstat (limited to 'src')
-rw-r--r--src/stdio/fflush.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/stdio/fflush.c b/src/stdio/fflush.c
index 2250aaaf..a1e984f9 100644
--- a/src/stdio/fflush.c
+++ b/src/stdio/fflush.c
@@ -13,7 +13,10 @@ int fflush(FILE *stream)
if (stream == NULL) {
size_t i;
for (i = 0; i < FOPEN_MAX; i++) {
- fflush(&(__stdio.FILES[i]));
+ stream = __stdio.FILES + i;
+ if (stream->write && (stream->operation != OP_INPUT)) {
+ fflush(stream);
+ }
}
return 0;
}