diff options
| author | Luna <git@l4.pm> | 2019-10-26 22:00:50 -0300 |
|---|---|---|
| committer | Luna <git@l4.pm> | 2019-10-26 22:00:50 -0300 |
| commit | bf16fc210bc765202489ae83e0ad1dce8d9b4e16 (patch) | |
| tree | 7ab6cf25343606c2065b80a2f83294c56c6bca54 /lib | |
| parent | fafd1fd4806e4f92b19bd5285cbe8d6748a90c54 (diff) | |
| download | zig-bf16fc210bc765202489ae83e0ad1dce8d9b4e16.tar.gz zig-bf16fc210bc765202489ae83e0ad1dce8d9b4e16.zip | |
fix std.os.accept4
- add WouldBlock to list of errors in AcceptError
- ptrCast addr_size to the system's socklen_t, instead of assuming it's
usize
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/std/os.zig | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/std/os.zig b/lib/std/os.zig index a1fe051997..50467c4c21 100644 --- a/lib/std/os.zig +++ b/lib/std/os.zig @@ -1630,6 +1630,10 @@ pub const AcceptError = error{ /// Firewall rules forbid connection. BlockedByFirewall, + + /// This error occurs when no global event loop is configured, + /// and accepting from the socket would block. + WouldBlock, } || UnexpectedError; /// Accept a connection on a socket. @@ -1661,7 +1665,7 @@ pub fn accept4( flags: u32, ) AcceptError!i32 { while (true) { - const rc = system.accept4(sockfd, addr, addr_size, flags); + const rc = system.accept4(sockfd, addr, @ptrCast(*system.socklen_t, addr_size), flags); switch (errno(rc)) { 0 => return @intCast(i32, rc), EINTR => continue, |
