summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/stdio/fflush.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/stdio/fflush.c b/src/stdio/fflush.c
index e6108fbd..1a237984 100644
--- a/src/stdio/fflush.c
+++ b/src/stdio/fflush.c
@@ -27,6 +27,10 @@ int fflush(FILE *stream)
return 0;
}
+ if (stream->bpos == 0) {
+ return 0;
+ }
+
flockfile(stream);
if (write(stream->fd, stream->buf, stream->bpos) < 0) {
/* errno is set */