Skip to content

Commit

Permalink
Remove fallback from accept4 to accept (envoyproxy#32227)
Browse files Browse the repository at this point in the history
* Remove fallback from accept4 to accept

Signed-off-by: Yan Avlasov <yavlasov@google.com>

* Address comments

Signed-off-by: Yan Avlasov <yavlasov@google.com>

---------

Signed-off-by: Yan Avlasov <yavlasov@google.com>
  • Loading branch information
yanavlasov authored Feb 6, 2024
1 parent 55b5265 commit e5087ac
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions source/common/api/posix/os_sys_calls_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -325,17 +325,12 @@ SysCallSocketResult OsSysCallsImpl::accept(os_fd_t sockfd, sockaddr* addr, sockl

#if defined(__linux__)
rc = ::accept4(sockfd, addr, addrlen, SOCK_NONBLOCK);
// If failed with EINVAL try without flags
if (rc >= 0 || errno != EINVAL) {
return {rc, rc != -1 ? 0 : errno};
}
#endif

#else
rc = ::accept(sockfd, addr, addrlen);
if (rc >= 0) {
setsocketblocking(rc, false);
}

#endif
return {rc, rc != -1 ? 0 : errno};
}

Expand Down

0 comments on commit e5087ac

Please sign in to comment.