From 0a694fe4ea0ad00398f4d80e20a2ebce73117ad6 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Mon, 19 Sep 2011 23:45:42 -0400 Subject: [PATCH] [wmiir] Flush conversion buffer on short read. Closes issue #235. --- cmd/wmiir.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/wmiir.c b/cmd/wmiir.c index a0e1661f..ecf9a92c 100644 --- a/cmd/wmiir.c +++ b/cmd/wmiir.c @@ -322,8 +322,11 @@ xread(int argc, char *argv[]) { fatal("Can't open file '%s': %r\n", file); buf = emalloc(fid->iounit); - while((count = ixp_read(fid, buf, fid->iounit)) > 0) + while((count = ixp_read(fid, buf, fid->iounit)) > 0) { unflush(1, buf, count, binary); + if (!binary && count < fid->iounit) + unflush(1, 0, 0, binary); + } if(!binary) unflush(1, 0, 0, binary); ixp_close(fid);