authorgravatar for me@govorov.onlineNikolay Govorov <me@govorov.online> 2025-11-18 18:15:22+00:00
committergravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2025-11-29 19:57:59+01:00
loga0289d0cce370729099a1ec0228e7f49bcdabc80
tree046b795ff2b120dc569ecad880914984ed19ce4c
parent7d9ad992ab636d51f24125e3ebb046d4333b1f80

std.posix.accept: handle non-listening socket EINVAL


2 files changed, 5 insertions(+), 1 deletions(-)

lib/std/Io/Threaded.zig+1-1
......@@ -3900,7 +3900,7 @@ fn netAcceptPosix(userdata: ?*anyopaque, listen_fd: net.Socket.Handle) net.Serve
39003900 .BADF => |err| return errnoBug(err), // File descriptor used after closed.
39013901 .CONNABORTED => return error.ConnectionAborted,
39023902 .FAULT => |err| return errnoBug(err),
3903 .INVAL => |err| return errnoBug(err),
3903 .INVAL => return error.SocketNotListening,
39043904 .NOTSOCK => |err| return errnoBug(err),
39053905 .MFILE => return error.ProcessFdQuotaExceeded,
39063906 .NFILE => return error.SystemFdQuotaExceeded,
lib/std/Io/net.zig+4
......@@ -1333,6 +1333,10 @@ pub const Server = struct {
13331333 /// Not enough free memory. This often means that the memory allocation is limited
13341334 /// by the socket buffer limits, not by the system memory.
13351335 SystemResources,
1336 /// Either `listen` was never called, or `shutdown` was called (possibly while
1337 /// this call was blocking). This allows `shutdown` to be used as a concurrent
1338 /// cancellation mechanism.
1339 SocketNotListening,
13361340 /// The network subsystem has failed.
13371341 NetworkDown,
13381342 /// No connection is already queued and ready to be accepted, and