summaryrefslogtreecommitdiff
path: root/src/Db.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/Db.zig')
-rw-r--r--src/Db.zig4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Db.zig b/src/Db.zig
index f0bfc3f5..e5364b44 100644
--- a/src/Db.zig
+++ b/src/Db.zig
@@ -1114,8 +1114,8 @@ pub const Cache = struct {
}
}{ .cap = c.cap, .went = &went }) catch return;
if (!went) return;
- var new_buf: [4200]u8 = undefined;
- const new = std.fmt.bufPrint(&new_buf, "{s}.new", .{c.path()}) catch unreachable; // a path of 4096 fits 4200
+ var new_buf: [c.path_buf.len + ".new".len]u8 = undefined;
+ const new = std.fmt.bufPrint(&new_buf, "{s}.new", .{c.path()}) catch unreachable; // path_buf's [4096]u8 and ".new" fit
const cwd = std.Io.Dir.cwd();
const file = cwd.createFile(io, new, .{ .read = true, .truncate = true }) catch return;
var buffer: std.Io.Writer.Allocating = .init(std.heap.c_allocator);