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
master
Isaac Freund 2020-11-30 18:49:41 +01:00 committed by Andrew Kelley
parent 21565ca991
commit 92ec24f77c
2 changed files with 4 additions and 8 deletions

View File

@ -1661,10 +1661,6 @@ pub const StreamServer = struct {
/// Firewall rules forbid connection. /// Firewall rules forbid connection.
BlockedByFirewall, BlockedByFirewall,
/// Permission to create a socket of the specified type and/or
/// protocol is denied.
PermissionDenied,
FileDescriptorNotASocket, FileDescriptorNotASocket,
ConnectionResetByPeer, ConnectionResetByPeer,

View File

@ -2942,10 +2942,6 @@ pub const AcceptError = error{
/// and accepting from the socket would block. /// and accepting from the socket would block.
WouldBlock, WouldBlock,
/// Permission to create a socket of the specified type and/or
/// protocol is denied.
PermissionDenied,
/// An incoming connection was indicated, but was subsequently terminated by the /// An incoming connection was indicated, but was subsequently terminated by the
/// remote peer prior to accepting the call. /// remote peer prior to accepting the call.
ConnectionResetByPeer, ConnectionResetByPeer,
@ -4130,12 +4126,14 @@ fn setSockFlags(sock: socket_t, flags: u32) !void {
var fd_flags = fcntl(sock, F_GETFD, 0) catch |err| switch (err) { var fd_flags = fcntl(sock, F_GETFD, 0) catch |err| switch (err) {
error.FileBusy => unreachable, error.FileBusy => unreachable,
error.Locked => unreachable, error.Locked => unreachable,
error.PermissionDenied => unreachable,
else => |e| return e, else => |e| return e,
}; };
fd_flags |= FD_CLOEXEC; fd_flags |= FD_CLOEXEC;
_ = fcntl(sock, F_SETFD, fd_flags) catch |err| switch (err) { _ = fcntl(sock, F_SETFD, fd_flags) catch |err| switch (err) {
error.FileBusy => unreachable, error.FileBusy => unreachable,
error.Locked => unreachable, error.Locked => unreachable,
error.PermissionDenied => unreachable,
else => |e| return e, else => |e| return e,
}; };
} }
@ -4156,12 +4154,14 @@ fn setSockFlags(sock: socket_t, flags: u32) !void {
var fl_flags = fcntl(sock, F_GETFL, 0) catch |err| switch (err) { var fl_flags = fcntl(sock, F_GETFL, 0) catch |err| switch (err) {
error.FileBusy => unreachable, error.FileBusy => unreachable,
error.Locked => unreachable, error.Locked => unreachable,
error.PermissionDenied => unreachable,
else => |e| return e, else => |e| return e,
}; };
fl_flags |= O_NONBLOCK; fl_flags |= O_NONBLOCK;
_ = fcntl(sock, F_SETFL, fl_flags) catch |err| switch (err) { _ = fcntl(sock, F_SETFL, fl_flags) catch |err| switch (err) {
error.FileBusy => unreachable, error.FileBusy => unreachable,
error.Locked => unreachable, error.Locked => unreachable,
error.PermissionDenied => unreachable,
else => |e| return e, else => |e| return e,
}; };
} }