mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-08 03:44:22 -04:00
If accept4 is absent, fall back to accept.
This commit is contained in:
parent
a6492cb744
commit
74d32dd493
10
evutil.c
10
evutil.c
@ -2425,10 +2425,13 @@ evutil_socket_t
|
||||
evutil_accept4(evutil_socket_t sockfd, struct sockaddr *addr,
|
||||
socklen_t *addrlen, int flags)
|
||||
{
|
||||
evutil_socket_t result;
|
||||
#if defined(_EVENT_HAVE_ACCEPT4) && defined(SOCK_CLOEXEC) && defined(SOCK_NONBLOCK)
|
||||
return accept4(sockfd, addr, addrlen, flags);
|
||||
#else
|
||||
evutil_socket_t result = accept(sockfd, addr, addrlen);
|
||||
result = accept4(sockfd, addr, addrlen, flags);
|
||||
if (result >= 0 || errno != EINVAL)
|
||||
return result;
|
||||
#endif
|
||||
result = accept(sockfd, addr, addrlen);
|
||||
if (result < 0)
|
||||
return result;
|
||||
|
||||
@ -2445,7 +2448,6 @@ evutil_accept4(evutil_socket_t sockfd, struct sockaddr *addr,
|
||||
}
|
||||
}
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Internal function: Set fd[0] and fd[1] to a pair of fds such that writes on
|
||||
|
Loading…
x
Reference in New Issue
Block a user