[wmiir] Flush conversion buffer on short read. Closes issue #235.

This commit is contained in:
Kris Maglione 2011-09-19 23:45:42 -04:00
parent 6594959ce8
commit 0a694fe4ea
1 changed files with 4 additions and 1 deletions

View File

@ -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);