diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/my_global.h | 2 | ||||
-rw-r--r-- | include/mysql/psi/mysql_socket.h | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/include/my_global.h b/include/my_global.h index 9db032d4024..dcfd607b455 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -600,6 +600,8 @@ typedef SOCKET_SIZE_TYPE size_socket; #endif #ifndef SOCK_CLOEXEC #define SOCK_CLOEXEC 0 +#else +#define HAVE_SOCK_CLOEXEC #endif /* additional file share flags for win32 */ diff --git a/include/mysql/psi/mysql_socket.h b/include/mysql/psi/mysql_socket.h index 1dbe8c7eb22..fc0a3ce2eb0 100644 --- a/include/mysql/psi/mysql_socket.h +++ b/include/mysql/psi/mysql_socket.h @@ -562,6 +562,12 @@ inline_mysql_socket_socket (key, (const my_socket*)&mysql_socket.fd, NULL, 0); } #endif + + /* SOCK_CLOEXEC isn't always a number - can't preprocessor compare */ +#if defined(HAVE_FCNTL) && defined(FD_CLOEXEC) && !defined(HAVE_SOCK_CLOEXEC) + (void) fcntl(mysql_socket.fd, F_SETFD, FD_CLOEXEC); +#endif + return mysql_socket; } |