summaryrefslogtreecommitdiff
path: root/src/9p_io.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/9p_io.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/9p_io.zig')
-rw-r--r--src/9p_io.zig2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/9p_io.zig b/src/9p_io.zig
index 10109bb8..bc122109 100644
--- a/src/9p_io.zig
+++ b/src/9p_io.zig
@@ -1737,7 +1737,7 @@ pub fn exportEnv(serial: u32, adopts: bool) void {
const socket: ?[]const u8 = if (own_socket_len > 0) own_socket[0..own_socket_len] else null;
const ChildEnv = @import("host_io.zig").ChildEnv;
var pid_buf: [16]u8 = undefined;
- ChildEnv.exportVar("PARDES_PID", if (adopts) std.fmt.bufPrint(&pid_buf, "{d}", .{@as(u32, @intCast(libc.getpid()))}) catch null else null);
+ ChildEnv.exportVar("PARDES_PID", if (adopts) std.fmt.bufPrint(&pid_buf, "{d}", .{@as(u32, @intCast(libc.getpid()))}) catch unreachable else null); // a u32 fits 16
if (socket) |own| {
var buf: [16]u8 = undefined;
ChildEnv.exportVar("PARDES_9P", own);