mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-10 04:50:37 -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,
|
evutil_accept4(evutil_socket_t sockfd, struct sockaddr *addr,
|
||||||
socklen_t *addrlen, int flags)
|
socklen_t *addrlen, int flags)
|
||||||
{
|
{
|
||||||
|
evutil_socket_t result;
|
||||||
#if defined(_EVENT_HAVE_ACCEPT4) && defined(SOCK_CLOEXEC) && defined(SOCK_NONBLOCK)
|
#if defined(_EVENT_HAVE_ACCEPT4) && defined(SOCK_CLOEXEC) && defined(SOCK_NONBLOCK)
|
||||||
return accept4(sockfd, addr, addrlen, flags);
|
result = accept4(sockfd, addr, addrlen, flags);
|
||||||
#else
|
if (result >= 0 || errno != EINVAL)
|
||||||
evutil_socket_t result = accept(sockfd, addr, addrlen);
|
return result;
|
||||||
|
#endif
|
||||||
|
result = accept(sockfd, addr, addrlen);
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
@ -2445,7 +2448,6 @@ evutil_accept4(evutil_socket_t sockfd, struct sockaddr *addr,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Internal function: Set fd[0] and fd[1] to a pair of fds such that writes on
|
/* 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