diff options
author | peter <peter@FreeBSD.org> | 2014-05-27 07:00:33 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2014-05-27 07:00:33 +0000 |
commit | ca02a2bfd2f08739388e00fb3bbe93fa3fa5efb0 (patch) | |
tree | 6266be92f31f93e7851b958a90b1f93c3aefbbe8 /network_io/unix/sockets.c | |
parent | ed0c2f87192e10d255a0e36819e6df2a1d83d5fb (diff) | |
download | FreeBSD-src-ca02a2bfd2f08739388e00fb3bbe93fa3fa5efb0.zip FreeBSD-src-ca02a2bfd2f08739388e00fb3bbe93fa3fa5efb0.tar.gz |
Vendor import apr-1.5.1
Diffstat (limited to 'network_io/unix/sockets.c')
-rw-r--r-- | network_io/unix/sockets.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/network_io/unix/sockets.c b/network_io/unix/sockets.c index 748dd70..514edb1 100644 --- a/network_io/unix/sockets.c +++ b/network_io/unix/sockets.c @@ -207,7 +207,20 @@ apr_status_t apr_socket_accept(apr_socket_t **new, apr_socket_t *sock, sa.salen = sizeof(sa.sa); #ifdef HAVE_ACCEPT4 - s = accept4(sock->socketdes, (struct sockaddr *)&sa.sa, &sa.salen, SOCK_CLOEXEC); + { + int flags = SOCK_CLOEXEC; + +#if defined(SOCK_NONBLOCK) && APR_O_NONBLOCK_INHERITED + /* With FreeBSD accept4() (avail in 10+), O_NONBLOCK is not inherited + * (unlike Linux). Mimic the accept() behavior here in a way that + * may help other platforms. + */ + if (apr_is_option_set(sock, APR_SO_NONBLOCK) == 1) { + flags |= SOCK_NONBLOCK; + } +#endif + s = accept4(sock->socketdes, (struct sockaddr *)&sa.sa, &sa.salen, flags); + } #else s = accept(sock->socketdes, (struct sockaddr *)&sa.sa, &sa.salen); #endif |