diff options
Diffstat (limited to 'src/ninep/pane.zig')
| -rw-r--r-- | src/ninep/pane.zig | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/ninep/pane.zig b/src/ninep/pane.zig index fef0f85f..d5f2f20a 100644 --- a/src/ninep/pane.zig +++ b/src/ninep/pane.zig @@ -662,7 +662,11 @@ fn writeTag(p: *Pardes, req: Req, pane: *Pane) Reply { // is a text like any other (acme's tag file appends the same way). const had = if (pf.tag_trunc_pending) 0 else tagline.curTail(pane).len; const room = limits.max_tag_tail -| had -| @intFromBool(pf.tag_held_newline and !pf.tag_trunc_pending); - if (req.data.len > room) { + // A rewrite drops its one trailing newline: `echo <4096 bytes> > tag` + // is 4096 bytes of tag, and fits. + const rewrite = pf.tag_rewrite or pf.tag_trunc_pending; + const counted = req.data.len - @intFromBool(rewrite and req.data[req.data.len - 1] == '\n'); + if (counted > room) { pf.tag_trunc_pending = false; return tree.failText(req.tag, E.NOSPC, e_tag_over); } |
