summaryrefslogtreecommitdiff
path: root/src/daemon.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon.zig')
-rw-r--r--src/daemon.zig9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/daemon.zig b/src/daemon.zig
index a4e2c2d9..118fa58a 100644
--- a/src/daemon.zig
+++ b/src/daemon.zig
@@ -341,14 +341,14 @@ fn tell(words: []const u8, fds: []const c_int) void {
/// A shell forked on `master` (host_io.forkShell): the daemon keeps a dup.
pub fn pty(pid: libc.pid_t, master: c_int) void {
var buf: [32]u8 = undefined;
- tell(std.fmt.bufPrint(&buf, "pty {d}", .{pid}) catch return, &.{master});
+ tell(std.fmt.bufPrint(&buf, "pty {d}", .{pid}) catch unreachable, &.{master}); // a pid fits 32
}
/// The pty of `pid` closed here: the daemon lets its dup go too.
pub fn closed(pid: libc.pid_t) void {
if (pid <= 0) return;
var buf: [32]u8 = undefined;
- tell(std.fmt.bufPrint(&buf, "close {d}", .{pid}) catch return, &.{});
+ tell(std.fmt.bufPrint(&buf, "close {d}", .{pid}) catch unreachable, &.{}); // a pid fits 32
}
pub fn setState(detached: bool) void {
@@ -360,8 +360,9 @@ pub fn setState(detached: bool) void {
pub fn clients(pids: []const libc.pid_t) void {
var buf: [64]u8 = undefined;
var w: std.Io.Writer = .fixed(&buf);
- w.writeAll("clients") catch return;
- for (pids[0..@min(pids.len, max_clients)]) |pid| w.print(" {d}", .{pid}) catch return;
+ // "clients" and max_clients pids fit 64.
+ w.writeAll("clients") catch unreachable;
+ for (pids[0..@min(pids.len, max_clients)]) |pid| w.print(" {d}", .{pid}) catch unreachable;
tell(w.buffered(), &.{});
}