summaryrefslogtreecommitdiff
path: root/src/ninep/events.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 09:11:37 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commita550753fb60be3cdc040c521ddaab9022f5d3248 (patch)
tree9d392076f417b6a9d53b6a1bc9ce7fe44d4e499b /src/ninep/events.zig
parent4d4818f7baf356866d323e4b337a64a3dddd8adb (diff)
downloadpardes-a550753fb60be3cdc040c521ddaab9022f5d3248.tar.gz
pardes-a550753fb60be3cdc040c521ddaab9022f5d3248.zip
Every EINVAL a write gets says why; DEL in an exec or look line is a control character
An empty name, a word written to log other than follow, a data, sel, dot or dirty write to a pane with no text, a truncate other than to zero, and a control character in a look line written through a held open were refused with no words, logged as `Invalid argument`. Each says its reason now; and DEL is refused in exec and look lines as in names. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep/events.zig')
-rw-r--r--src/ninep/events.zig4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ninep/events.zig b/src/ninep/events.zig
index d7079c5e..f58d970e 100644
--- a/src/ninep/events.zig
+++ b/src/ninep/events.zig
@@ -101,7 +101,7 @@ pub const Queue = struct {
/// One record per read; `.again` holds the read until a record arrives.
pub fn readQueue(p: *Pardes, req: Req, q: *Queue) Reply {
const record = q.peek() orelse return .{ .tag = req.tag, .status = .again };
- if (req.size < record.len) return Reply.fail(req.tag, E.INVAL);
+ if (req.size < record.len) return tree.failText(req.tag, E.INVAL, "invalid read: shorter than the record waiting");
const out = p.fs.stage(p.gpa);
out.appendSlice(p.gpa, record) catch return Reply.fail(req.tag, E.NOMEM);
q.pop();
@@ -477,7 +477,7 @@ pub fn writeLog(p: *Pardes, req: Req) Reply {
// what was there and waits for what comes after, as tail -n0 -f does.
if (std.mem.eql(u8, word, "follow new")) {
slot.pos = slot.bytes.len;
- } else if (!std.mem.eql(u8, word, "follow")) return Reply.fail(req.tag, E.INVAL);
+ } else if (!std.mem.eql(u8, word, "follow")) return tree.failText(req.tag, E.INVAL, "invalid write to log: it takes `follow` or `follow new`");
slot.follow = true;
return .{ .tag = req.tag, .written = @intCast(req.data.len) };
}