authorgravatar for mail@isaacfreund.comIsaac Freund <mail@isaacfreund.com> 2020-11-30 18:49:41+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-11-30 20:00:26-08:00
log92ec24f77c6c146fd9943a41b055603ff1e442a5
tree36f99ea3a65d2a787a0908b51544a0625e6e1c5f
parent21565ca991bba9692ed74ec9fb9a665f8e504c7f

std/os: remove unneeded error from accept errorset

POSIX compliant fnctl cannot return EPERM when getting/setting the given flags. See the specification here: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html

2 files changed, 4 insertions(+), 8 deletions(-)

lib/std/net.zig-4
......@@ -1661,10 +1661,6 @@ pub const StreamServer = struct {
16611661 /// Firewall rules forbid connection.
16621662 BlockedByFirewall,
16631663
1664 /// Permission to create a socket of the specified type and/or
1665 /// protocol is denied.
1666 PermissionDenied,
1667
16681664 FileDescriptorNotASocket,
16691665
16701666 ConnectionResetByPeer,
lib/std/os.zig+4-4
......@@ -2942,10 +2942,6 @@ pub const AcceptError = error{
29422942 /// and accepting from the socket would block.
29432943 WouldBlock,
29442944
2945 /// Permission to create a socket of the specified type and/or
2946 /// protocol is denied.
2947 PermissionDenied,
2948
29492945 /// An incoming connection was indicated, but was subsequently terminated by the
29502946 /// remote peer prior to accepting the call.
29512947 ConnectionResetByPeer,
......@@ -4130,12 +4126,14 @@ fn setSockFlags(sock: socket_t, flags: u32) !void {
41304126 var fd_flags = fcntl(sock, F_GETFD, 0) catch |err| switch (err) {
41314127 error.FileBusy => unreachable,
41324128 error.Locked => unreachable,
4129 error.PermissionDenied => unreachable,
41334130 else => |e| return e,
41344131 };
41354132 fd_flags |= FD_CLOEXEC;
41364133 _ = fcntl(sock, F_SETFD, fd_flags) catch |err| switch (err) {
41374134 error.FileBusy => unreachable,
41384135 error.Locked => unreachable,
4136 error.PermissionDenied => unreachable,
41394137 else => |e| return e,
41404138 };
41414139 }
......@@ -4156,12 +4154,14 @@ fn setSockFlags(sock: socket_t, flags: u32) !void {
41564154 var fl_flags = fcntl(sock, F_GETFL, 0) catch |err| switch (err) {
41574155 error.FileBusy => unreachable,
41584156 error.Locked => unreachable,
4157 error.PermissionDenied => unreachable,
41594158 else => |e| return e,
41604159 };
41614160 fl_flags |= O_NONBLOCK;
41624161 _ = fcntl(sock, F_SETFL, fl_flags) catch |err| switch (err) {
41634162 error.FileBusy => unreachable,
41644163 error.Locked => unreachable,
4164 error.PermissionDenied => unreachable,
41654165 else => |e| return e,
41664166 };
41674167 }