summaryrefslogtreecommitdiff
path: root/src/ninep/sources.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/ninep/sources.zig')
-rw-r--r--src/ninep/sources.zig6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ninep/sources.zig b/src/ninep/sources.zig
index 32edb1f6..2e96b539 100644
--- a/src/ninep/sources.zig
+++ b/src/ninep/sources.zig
@@ -38,7 +38,7 @@ fn info(n: u64) ?struct { path: []const u8, contents: []const u8, dir: bool } {
/// Stages the children of one archive directory; "" lists the top-level
/// directories the served root shows.
-pub fn stage(p: *Pardes, out: *std.ArrayList(u8), path: []const u8, skip: *u64) void {
+pub fn stage(p: *Pardes, out: *std.ArrayList(u8), path: []const u8, skip: *u64) error{OutOfMemory}!void {
var seen: [sources.len][]const u8 = undefined;
var count: usize = 0;
for (sources, 0..) |source, i| {
@@ -61,7 +61,7 @@ pub fn stage(p: *Pardes, out: *std.ArrayList(u8), path: []const u8, skip: *u64)
continue;
}
const child = archive_node | (@as(u64, i) << 12) | (start + len);
- tree.stageDirent(out, p.gpa, child, len < rest.len, name);
+ try tree.stageDirent(out, p.gpa, child, len < rest.len, name);
}
}
@@ -97,7 +97,7 @@ pub fn handle(p: *Pardes, req: Req) Reply {
if (!found.dir) return Reply.fail(req.tag, E.NOTDIR);
const out = p.fs.stage(p.gpa);
var skip = req.off;
- stage(p, out, found.path, &skip);
+ stage(p, out, found.path, &skip) catch return Reply.fail(req.tag, E.NOMEM);
return .{ .tag = req.tag, .payload = .{ .staged = @intCast(out.items.len) } };
},
.read => {