ref: e8974827713daccc5f7ee28effc72060d7c20a56
parent: 68a78ecc802088dfb7cdd1c477a4fa6340442b7b
author: Ori Bernstein <ori@eigenstate.org>
date: Tue Dec 29 17:35:38 EST 2015
Avoid spurious reads. We were reading more than we should have. This fixes it.
--- a/lib/bio/bio.myr
+++ b/lib/bio/bio.myr
@@ -198,7 +198,7 @@
* syscall for every read
*/
if dst.len < Small
- fill(f, f.rbuf.len - f.rend)
+ fill(f, dst.len)
;;
/* Read as much as we can from the buffer */
count = std.min(dst.len, f.rend - f.rstart)
@@ -213,7 +213,7 @@
/* Read the rest directly from the fd */
d = dst[count:]
- while dst.len > 0
+ while d.len > 0
match std.read(f.fd, d)
| `std.Ok 0:
break