ba71ab5e
pty: close master fd on fcntl failure in openForScenario
a73x 2026-04-19 13:23
Commit message
src/pty.zig
| Old | New | ||
|---|---|---|---|
| @@ -124,6 +124,7 @@ pub const Pty = struct { | |||
| 124 | } | 124 | } |
| 125 | // Slave fd isn't used by anyone in scenario mode; close to avoid leak. | 125 | // Slave fd isn't used by anyone in scenario mode; close to avoid leak. |
| 126 | _ = c.close(slave); | 126 | _ = c.close(slave); |
| 127 | errdefer _ = c.close(master); | ||
| 127 | 128 | ||
| 128 | // Match spawn's O_NONBLOCK on master. | 129 | // Match spawn's O_NONBLOCK on master. |
| 129 | const flags = try std.posix.fcntl(master, std.posix.F.GETFL, 0); | 130 | const flags = try std.posix.fcntl(master, std.posix.F.GETFL, 0); |