std.posix.errno(rc) may lose error specificity for C wrappersstd.posix.errno(rc) may lose error specificity for C wrappersFile: src/client/connect.zig:38–48
Severity: MEDIUM
Status: ✅ FIXED — replaced std.posix.errno(rc) with std.c.errno(rc) which properly reads _errno().* when rc == -1. Unit test added.
fn mapErr(rc: c_int) Error!i32 {
if (rc >= 0) return rc;
return switch (std.posix.errno(rc)) { ... };
}
C socket() and connect() return -1 on failure, setting the global errno. If std.posix.errno(rc) derives the error from rc (which is -1), it always decodes to errno 1 (EPERM) — all socket failures fall through to error.Unexpected. The fix should use std.c._errno().* directly.