diff options
author | Jakob Kaivo <jkk@ung.org> | 2024-05-29 16:58:53 -0400 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2024-05-29 16:58:53 -0400 |
commit | 4dbffd990276fc6b9a3ffcca4a3c6686cc60ef4c (patch) | |
tree | 98552b7ea85a819fe63680afb87c2b5a943c0e05 | |
parent | ca806410c73085644116fa2979eaf3d5f3cbd35f (diff) |
only attempt to flush streams that can be flushed when parameter is NULL
-rw-r--r-- | src/stdio/fflush.c | 5 |
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; } |