mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 16:43:03 +01:00
Added check for SOCK_CLOEXEC
This commit is contained in:
parent
7adbe5a75a
commit
8b7501f136
17
configure.ac
17
configure.ac
@ -726,7 +726,6 @@ AC_CHECK_HEADERS(rpc/xdr.h,,,[#include <rpc/rpc.h>])
|
||||
AC_CHECK_HEADERS(aio.h)
|
||||
AC_CHECK_HEADERS(mntent.h mnttab.h sys/mntent.h sys/mnttab.h)
|
||||
AC_CHECK_HEADERS(sys/ipc.h sys/file.h)
|
||||
AC_CHECK_HEADERS(socket.h sys/socket.h sys/sockio.h winsock2.h)
|
||||
AC_CHECK_HEADERS(sys/resource.h)
|
||||
AC_CHECK_HEADERS(sys/sem.h)
|
||||
AC_CHECK_HEADERS(semaphore.h)
|
||||
@ -739,6 +738,22 @@ AC_CHECK_HEADERS(iconv.h)
|
||||
AC_CHECK_HEADERS(libio.h)
|
||||
AC_CHECK_HEADERS(linux/falloc.h)
|
||||
|
||||
AC_CHECK_HEADERS(socket.h sys/socket.h sys/sockio.h winsock2.h)
|
||||
AC_CHECK_DECLS(SOCK_CLOEXEC,,,[[
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_SOCKET_H
|
||||
#include <socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKIO_H
|
||||
#include <sys/sockio.h>
|
||||
#endif
|
||||
#ifdef HAVE_WINSOCK2_H
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
]])
|
||||
|
||||
dnl check for compression
|
||||
if test "$COMPRESSION" = "Y"; then
|
||||
AC_CHECK_HEADERS(zlib.h,,AC_MSG_ERROR(zlib header not found - please install development zlib package))
|
||||
|
@ -3058,11 +3058,13 @@ SOCKET socket(int domain, int type, int protocol)
|
||||
return ::socket(domain, type, protocol);
|
||||
#else
|
||||
int fd;
|
||||
#if HAVE_DECL_SOCK_CLOEXEC
|
||||
do {
|
||||
fd = ::socket(domain, type | SOCK_CLOEXEC, protocol);
|
||||
} while (fd < 0 && SYSCALL_INTERRUPTED(errno));
|
||||
|
||||
if (fd < 0 && errno == EINVAL) // probably O_CLOEXEC not accepted
|
||||
#endif
|
||||
{
|
||||
do {
|
||||
fd = ::socket(domain, type, protocol);
|
||||
@ -3081,20 +3083,18 @@ SOCKET accept(SOCKET sockfd, struct sockaddr *addr, socklen_t *addrlen)
|
||||
return ::accept(sockfd, addr, addrlen);
|
||||
#else
|
||||
int fd;
|
||||
#ifdef HAVE_ACCEPT4
|
||||
#if defined(HAVE_ACCEPT4) && HAVE_DECL_SOCK_CLOEXEC
|
||||
do {
|
||||
fd = ::accept4(sockfd, addr, addrlen, SOCK_CLOEXEC);
|
||||
} while (fd < 0 && SYSCALL_INTERRUPTED(errno));
|
||||
|
||||
if (fd < 0 && errno == EINVAL) // probably O_CLOEXEC not accepted
|
||||
{
|
||||
#endif
|
||||
{
|
||||
do {
|
||||
fd = ::accept(sockfd, addr, addrlen);
|
||||
} while (fd < 0 && SYSCALL_INTERRUPTED(errno));
|
||||
#ifdef HAVE_ACCEPT4
|
||||
}
|
||||
#endif
|
||||
|
||||
setCloseOnExec(fd);
|
||||
return fd;
|
||||
|
Loading…
Reference in New Issue
Block a user