summaryrefslogtreecommitdiff
path: root/src/Db.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-06 12:38:55 -0300
committerGabriel Schneider <[email protected]>2026-11-06 14:56:36 -0300
commitdde4979f59bec754b7909a81a40763850f3c29c0 (patch)
treec885f4ddc37f0564b4b20345c1a0f02672663252 /src/Db.zig
parent4c194047d210ad9cf571c6019731d00d1e3615a4 (diff)
downloadpardes-dde4979f59bec754b7909a81a40763850f3c29c0.tar.gz
pardes-dde4979f59bec754b7909a81a40763850f3c29c0.zip
idioms #5, more formats that cannot overflow: /proc paths of a pid, the daemon's pty, close and clients words, a pid or a serial for the environment, a capture's header and status line and a cache's .new name are catch unreachable with their reason, where a catch return, null or continue stood for an overflow no buffer here can have
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/Db.zig')
-rw-r--r--src/Db.zig2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/Db.zig b/src/Db.zig
index 27557ac4..f0bfc3f5 100644
--- a/src/Db.zig
+++ b/src/Db.zig
@@ -1115,7 +1115,7 @@ 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 return;
+ const new = std.fmt.bufPrint(&new_buf, "{s}.new", .{c.path()}) catch unreachable; // a path of 4096 fits 4200
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);