Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,7 @@ dnl Checks for library functions.
dnl ----------------------------------------------------------------------------

AC_CHECK_FUNCS(m4_normalize([
accept4
alphasort
asctime_r
asprintf
Expand Down
2 changes: 1 addition & 1 deletion ext/sockets/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PHP_ARG_ENABLE([sockets],
[Enable sockets support])])

if test "$PHP_SOCKETS" != "no"; then
AC_CHECK_FUNCS([hstrerror if_nametoindex if_indextoname sockatmark accept4])
AC_CHECK_FUNCS([hstrerror if_nametoindex if_indextoname sockatmark])
AC_CHECK_HEADERS([sys/sockio.h linux/filter.h linux/if_packet.h linux/if_ether.h linux/udp.h])
AC_DEFINE([HAVE_SOCKETS], [1],
[Define to 1 if the PHP extension 'sockets' is available.])
Expand Down
7 changes: 6 additions & 1 deletion main/fastcgi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1394,7 +1394,11 @@ int fcgi_accept_request(fcgi_request *req)
socklen_t len = sizeof(sa);

FCGI_LOCK(req->listen_socket);
#if defined(HAVE_ACCEPT4)
req->fd = accept4(listen_socket, (struct sockaddr *)&sa, &len, SOCK_CLOEXEC);
#else
req->fd = accept(listen_socket, (struct sockaddr *)&sa, &len);
#endif
FCGI_UNLOCK(req->listen_socket);

client_sa = sa;
Expand All @@ -1414,7 +1418,8 @@ int fcgi_accept_request(fcgi_request *req)
return -1;
}

#if defined(F_SETFD) && defined(FD_CLOEXEC)
// TODO once we drop support for older solaris (i.e < 11.4) we could drop this block
#if defined(F_SETFD) && defined(FD_CLOEXEC) && !defined(HAVE_ACCEPT4)
int fd_attrs = fcntl(req->fd, F_GETFD);
if (0 > fd_attrs) {
fcgi_log(FCGI_WARNING, "failed to get attributes of the connection socket");
Expand Down
Loading