summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-07-14 15:10:59 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-07-14 15:10:59 +0300
commit646a6005e7882f9d4baf516c7936e5ef88ea89a6 (patch)
treed5b348bec9d756be164dd83fa052b80512f77e2f /include
parent6b6c012f330cbbdcdee32333f16813764e5ed466 (diff)
parent67a03b7c947f5a0cfddbe1acc5e560fc737b0848 (diff)
downloadmariadb-git-646a6005e7882f9d4baf516c7936e5ef88ea89a6.tar.gz
Merge 10.1 into 10.2
Diffstat (limited to 'include')
-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 88991e62632..918acb65ebe 100644
--- a/include/mysql/psi/mysql_socket.h
+++ b/include/mysql/psi/mysql_socket.h
@@ -1043,10 +1043,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
@@ -1065,10 +1069,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