Details
-
Bug
-
Status: Open (View Workflow)
-
Minor
-
Resolution: Unresolved
-
None
-
None
-
None
-
None
-
Linux archlinux 5.0.9-arch1-1-ARCH #1 SMP PREEMPT Sat Apr 20 15:00:46 UTC 2019 x86_64 GNU/Linux
Installed mariadb packages:
- local/mariadb 10.3.14-1
- local/mariadb-clients 10.3.14-1
- local/mariadb-libs 10.3.14-1
Description
After opening connection with mysql_real_connect(), the connection socket (the one that mysql_get_socket() returns) has no close-on-exec flag set. The following code is needed after calling mysql_real_connect() to get this flag set:
// Set CLOEXEC flag on the mysql socket
|
int mysql_socket = mysql_get_socket(...); |
int flags = fcntl(mysql_socket, F_GETFD); |
if (flags == -1) |
/* Handle error */; |
if (fcntl(mysql_socket, F_SETFD, flags | FD_CLOEXEC) == -1) |
/* Handle error */; |
I suppose that this flag should be set by the connector, for security reasons.