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...@@ -3900,7 +3900,7 @@ fn netAcceptPosix(userdata: ?*anyopaque, listen_fd: net.Socket.Handle) net.Serve
3900 .BADF => |err| return errnoBug(err), // File descriptor used after closed.3900 .BADF => |err| return errnoBug(err), // File descriptor used after closed.
3901 .CONNABORTED => return error.ConnectionAborted,3901 .CONNABORTED => return error.ConnectionAborted,
3902 .FAULT => |err| return errnoBug(err),3902 .FAULT => |err| return errnoBug(err),
3903 .INVAL => |err| return errnoBug(err),3903 .INVAL => return error.SocketNotListening,
3904 .NOTSOCK => |err| return errnoBug(err),3904 .NOTSOCK => |err| return errnoBug(err),
3905 .MFILE => return error.ProcessFdQuotaExceeded,3905 .MFILE => return error.ProcessFdQuotaExceeded,
3906 .NFILE => return error.SystemFdQuotaExceeded,3906 .NFILE => return error.SystemFdQuotaExceeded,
lib/std/Io/net.zig+4
...@@ -1333,6 +1333,10 @@ pub const Server = struct {...@@ -1333,6 +1333,10 @@ pub const Server = struct {
1333 /// Not enough free memory. This often means that the memory allocation is limited1333 /// Not enough free memory. This often means that the memory allocation is limited
1334 /// by the socket buffer limits, not by the system memory.1334 /// by the socket buffer limits, not by the system memory.
1335 SystemResources,1335 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,
1336 /// The network subsystem has failed.1340 /// The network subsystem has failed.
1337 NetworkDown,1341 NetworkDown,
1338 /// No connection is already queued and ready to be accepted, and1342 /// No connection is already queued and ready to be accepted, and