summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2020-05-19 10:36:25 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2020-05-19 10:36:25 +0200
commit659591a7db5b17e99cca68368ca90e703ac2cb57 (patch)
tree70992e3f8cdf6307d422fa975fa554de5c47a89d
parent44c8d84908e9d697bbcea55d6ebcd5f2250c4727 (diff)
downloadmariadb-git-bb-10.1-MDEV-22173.tar.gz
check MDEV-22173bb-10.1-MDEV-22173
-rw-r--r--include/mysql/psi/mysql_socket.h24
1 files changed, 16 insertions, 8 deletions
diff --git a/include/mysql/psi/mysql_socket.h b/include/mysql/psi/mysql_socket.h
index a7397795f77..2ab6932e396 100644
--- a/include/mysql/psi/mysql_socket.h
+++ b/include/mysql/psi/mysql_socket.h
@@ -1048,10 +1048,14 @@ inline_mysql_socket_accept
#else
socket_accept.fd= accept(socket_listen.fd, addr, &addr_length);
#ifdef FD_CLOEXEC
- flags= fcntl(socket_accept.fd, F_GETFD);
- if (flags != -1) {
- flags |= FD_CLOEXEC;
- fcntl(socket_accept.fd, F_SETFD, flags);
+ if (socket_accept.fd != INVALID_SOCKET)
+ {
+ flags= fcntl(socket_accept.fd, F_GETFD);
+ if (flags != -1)
+ {
+ flags |= FD_CLOEXEC;
+ fcntl(socket_accept.fd, F_SETFD, flags);
+ }
}
#endif
#endif
@@ -1070,10 +1074,14 @@ inline_mysql_socket_accept
#else
socket_accept.fd= accept(socket_listen.fd, addr, &addr_length);
#ifdef FD_CLOEXEC
- flags= fcntl(socket_accept.fd, F_GETFD);
- if (flags != -1) {
- flags |= FD_CLOEXEC;
- fcntl(socket_accept.fd, F_SETFD, flags);
+ if (socket_accept.fd != INVALID_SOCKET)
+ {
+ flags= fcntl(socket_accept.fd, F_GETFD);
+ if (flags != -1)
+ {
+ flags |= FD_CLOEXEC;
+ fcntl(socket_accept.fd, F_SETFD, flags);
+ }
}
#endif
#endif