summaryrefslogtreecommitdiff
path: root/lib/bio
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-12-29 22:35:38 -0800
committerOri Bernstein <ori@eigenstate.org>2015-12-29 22:35:38 -0800
commite8974827713daccc5f7ee28effc72060d7c20a56 (patch)
tree799d979930b531b36fae054a60e5a7d2e971f582 /lib/bio
parent68a78ecc802088dfb7cdd1c477a4fa6340442b7b (diff)
downloadmc-e8974827713daccc5f7ee28effc72060d7c20a56.tar.gz
Avoid spurious reads.
We were reading more than we should have. This fixes it.
Diffstat (limited to 'lib/bio')
-rw-r--r--lib/bio/bio.myr4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/bio/bio.myr b/lib/bio/bio.myr
index da9b37d..bbcaebb 100644
--- a/lib/bio/bio.myr
+++ b/lib/bio/bio.myr
@@ -198,7 +198,7 @@ const read = {f, dst
* 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 @@ const read = {f, dst
/* 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