repos / zmx

session persistence for terminal processes
git clone https://github.com/neurosnap/zmx.git

commit
f944dff
parent
e28fae1
author
Eric Bower
date
2025-11-26 20:02:01 -0500 EST
fix: ensure the fd is closed if initUnix, bind, or listen fails
1 files changed,  +1, -0
M src/main.zig
+1, -0
1@@ -817,6 +817,7 @@ fn createSocket(fname: []const u8) !i32 {
2     // SOCK.STREAM: Reliable, bidirectional communication
3     // SOCK.NONBLOCK: Set socket to non-blocking
4     const fd = try posix.socket(posix.AF.UNIX, posix.SOCK.STREAM | posix.SOCK.NONBLOCK | posix.SOCK.CLOEXEC, 0);
5+    errdefer posix.close(fd);
6 
7     var unix_addr = try std.net.Address.initUnix(fname);
8     try posix.bind(fd, &unix_addr.any, unix_addr.getOsSockLen());