summaryrefslogtreecommitdiff
path: root/src/fs.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs.zig')
-rw-r--r--src/fs.zig4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/fs.zig b/src/fs.zig
index 4414c150..352aa0c4 100644
--- a/src/fs.zig
+++ b/src/fs.zig
@@ -224,12 +224,12 @@ pub fn osHandle(p: *pardes.Pardes, req: Req) Reply {
if (fd < 0) return Reply.fail(req.tag, E.PERM);
defer _ = libc.close(fd);
if (req.op == .setattr) {
- if (!req.truncate or req.off != 0 or libc.ftruncate(fd, 0) != 0) return Reply.fail(req.tag, E.INVAL);
+ if (!req.truncate or req.off != 0 or libc.ftruncate(fd, 0) != 0) return tree.failText(req.tag, E.INVAL, "invalid truncate: only to zero");
var truncated = attr;
truncated.size = 0;
return .{ .tag = req.tag, .attr = truncated };
}
- if (req.off > std.math.maxInt(i64)) return Reply.fail(req.tag, E.INVAL);
+ if (req.off > std.math.maxInt(i64)) return tree.failText(req.tag, E.INVAL, "invalid offset: past what a file may hold");
if (libc.lseek(fd, @intCast(req.off), libc.SEEK.SET) < 0) return Reply.fail(req.tag, E.IO);
if (req.op == .write) {
const written = libc.write(fd, req.data.ptr, req.data.len);