summaryrefslogtreecommitdiff
path: root/lib/std
diff options
context:
space:
mode:
Diffstat (limited to 'lib/std')
-rw-r--r--lib/std/slurp.myr6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/std/slurp.myr b/lib/std/slurp.myr
index 576c39e..e644a87 100644
--- a/lib/std/slurp.myr
+++ b/lib/std/slurp.myr
@@ -37,8 +37,10 @@ const fslurp = {fd
-> `Ok buf[:len]
| `Ok n:
len += n
- bufsz *= 2
- buf = slgrow(buf, bufsz)
+ if len + 2*n >= bufsz
+ bufsz *= 2
+ buf = slgrow(buf, bufsz)
+ ;;
| `Fail e:
-> `Fail e
;;