diff options
author | Jakob Kaivo <jkk@ung.org> | 2020-08-18 16:11:10 -0400 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2020-08-18 16:11:10 -0400 |
commit | 57d205315ced82d9ff346c8112981ff67df24160 (patch) | |
tree | 22fd97dad749477dfa730d49a48afccd998d5c63 /src | |
parent | 55fc64c7ffd7792bc88451a736c2e94e5865282f (diff) |
noop if there is nothing to flush
Diffstat (limited to 'src')
-rw-r--r-- | src/stdio/fflush.c | 4 |
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 */ |