ba71ab5e
pty: close master fd on fcntl failure in openForScenario
a73x 2026-04-19 13:23
errdefer guards against a leaked master fd if either fcntl call errors. Happy path unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
diff --git a/src/pty.zig b/src/pty.zig index 23b42ea..c57d6a1 100644 --- a/src/pty.zig +++ b/src/pty.zig @@ -124,6 +124,7 @@ pub const Pty = struct { } // Slave fd isn't used by anyone in scenario mode; close to avoid leak. _ = c.close(slave); errdefer _ = c.close(master); // Match spawn's O_NONBLOCK on master. const flags = try std.posix.fcntl(master, std.posix.F.GETFL, 0);