Commit 2bbc868c authored by Jan Lindström's avatar Jan Lindström Committed by GitHub

Merge pull request #710 from grooverdan/10.0-galera-MDEV-8743-mysqld-socket-o_cloexec

MDEV-8743: mysqld port/socket - FD_CLOEXEC if no SOCK_CLOEXEC
parents 2e5681a4 ccd566af
......@@ -608,6 +608,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 */
......
......@@ -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;
}
......
......@@ -2594,10 +2594,6 @@ static MYSQL_SOCKET activate_tcp_port(uint port)
socket_errno);
unireg_abort(1);
}
#if defined(WITH_WSREP) && defined(HAVE_FCNTL) && defined(FD_CLOEXEC)
(void) fcntl(mysql_socket_getfd(ip_sock), F_SETFD, FD_CLOEXEC);
#endif /* WITH_WSREP */
DBUG_RETURN(ip_sock);
}
......@@ -2715,9 +2711,6 @@ static void network_init(void)
if (mysql_socket_listen(unix_sock,(int) back_log) < 0)
sql_print_warning("listen() on Unix socket failed with error %d",
socket_errno);
#if defined(WITH_WSREP) && defined(HAVE_FCNTL)
(void) fcntl(mysql_socket_getfd(unix_sock), F_SETFD, FD_CLOEXEC);
#endif /* WITH_WSREP */
}
#endif
DBUG_PRINT("info",("server started"));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment