From 57d205315ced82d9ff346c8112981ff67df24160 Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Tue, 18 Aug 2020 16:11:10 -0400 Subject: noop if there is nothing to flush --- src/stdio/fflush.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') 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 */ -- cgit v1.2.1