hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 3bc51a7939630240d0631c628cce6f8a7a9b3dd9
parent 9bedb017e94feed235c1fd63466a2ceb9ee03f48
Author: Drew DeVault <sir@cmpwn.com>
Date:   Sun, 23 May 2021 14:58:07 -0400

bufio::flush: don't flush without any pending data

This fixes the weird write syscall that gets called on @fini for any
Hare program which links to os.

Signed-off-by: Drew DeVault <sir@cmpwn.com>

Diffstat:
Mbufio/buffered.ha | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git a/bufio/buffered.ha b/bufio/buffered.ha @@ -74,6 +74,9 @@ export fn flush(s: *io::stream) (io::error | void) = { assert(s.writer == &buffered_write, "bufio::flushed used on non-buffered stream"); let s = s: *bufstream; + if (s.wavail == 0) { + return; + }; io::write(s.source, s.wbuffer[..s.wavail])?; s.wavail = 0; return;