From: <ale...@us...> - 2015-03-30 11:12:29
|
Revision: 61155 http://sourceforge.net/p/firebird/code/61155 Author: alexpeshkoff Date: 2015-03-30 11:12:27 +0000 (Mon, 30 Mar 2015) Log Message: ----------- Added check for SOCK_CLOEXEC Modified Paths: -------------- firebird/trunk/configure.ac firebird/trunk/src/remote/inet.cpp Modified: firebird/trunk/configure.ac =================================================================== --- firebird/trunk/configure.ac 2015-03-30 10:39:06 UTC (rev 61154) +++ firebird/trunk/configure.ac 2015-03-30 11:12:27 UTC (rev 61155) @@ -726,7 +726,6 @@ 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(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)) Modified: firebird/trunk/src/remote/inet.cpp =================================================================== --- firebird/trunk/src/remote/inet.cpp 2015-03-30 10:39:06 UTC (rev 61154) +++ firebird/trunk/src/remote/inet.cpp 2015-03-30 11:12:27 UTC (rev 61155) @@ -3058,11 +3058,13 @@ 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 @@ 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 { -#endif do { fd = ::accept(sockfd, addr, addrlen); } while (fd < 0 && SYSCALL_INTERRUPTED(errno)); -#ifdef HAVE_ACCEPT4 } -#endif setCloseOnExec(fd); return fd; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |