commit 0a694fe4ea0ad00398f4d80e20a2ebce73117ad6
parent 6594959ce88075310ca1b5f076c6542b15949848
Author: Kris Maglione <kris@suckless.org>
Date: Mon, 19 Sep 2011 23:45:42 -0400
[wmiir] Flush conversion buffer on short read. Closes issue #235.
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git 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);