diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-30 21:52:42 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:17 -0300 |
| commit | cc8b72c1b1fd19cd3ef159fe4f56c7b7916380ce (patch) | |
| tree | fd35f74770e43c019ad36df46be603a9c2e8f99f /src/builtins.zig | |
| parent | ea4ee39629b8690803c9e5b8b45ec07bdb9738ac (diff) | |
| download | pardes-cc8b72c1b1fd19cd3ef159fe4f56c7b7916380ce.tar.gz pardes-cc8b72c1b1fd19cd3ef159fe4f56c7b7916380ce.zip | |
Mount with no dial is wrong #args, and a dial that is no address says bad dial address, both EINVAL
Mount name alone failed "Mount name dial: missing argument" and a
malformed dial "Mount: bad dial", both EIO, though each is a malformed
request. They now say wrong #args and bad dial address (with the forms
a dial takes), and a builtin failure in those words answers EINVAL, as
9ns reads them.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/builtins.zig')
| -rw-r--r-- | src/builtins.zig | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/builtins.zig b/src/builtins.zig index bc9bb075..89d89c3a 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -790,10 +790,15 @@ pub const Mount = struct { pub fn run(c: Ctx) void { if (comptime !enabled) unreachable; var args = std.mem.tokenizeAny(u8, c.arg orelse "", " \t"); - const name = args.next() orelse return c.p.reportError(c.id, "Mount name dial", error.MissingArgument); + const e_args = "wrong #args in control message \"Mount\": Mount name dial"; + const name = args.next() orelse return c.p.reportFailure(c.id, e_args); const dial = std.mem.trim(u8, args.rest(), " \t"); - if (dial.len == 0) return c.p.reportError(c.id, "Mount name dial", error.MissingArgument); - c.p.fs.mount(c.p.gpa, name, dial) catch |err| return c.p.reportError(c.id, "Mount", err); + if (dial.len == 0) return c.p.reportFailure(c.id, e_args); + c.p.fs.mount(c.p.gpa, name, dial) catch |err| { + var said: [200]u8 = undefined; + if (err == error.BadDial) return c.p.reportFailure(c.id, std.fmt.bufPrint(&said, "Mount: bad dial address: {s} (unix!/path, tcp!host!port, or a session name)", .{dial[0..@min(dial.len, 100)]}) catch "Mount: bad dial address"); + return c.p.reportError(c.id, "Mount", err); + }; // A mount that cannot be reached is said now, and taken back, not // found out by the first look through it. const reached = reached: { |
