diff options
author | B. Stack <bgstack15@gmail.com> | 2021-04-05 15:59:11 +0000 |
---|---|---|
committer | B. Stack <bgstack15@gmail.com> | 2021-04-05 15:59:11 +0000 |
commit | 8d28254d708c88ae4aaebbc82cbb6c91726aa390 (patch) | |
tree | dafb5e266c513a5ed9863401e62d246742861e0c /zen/socket.h | |
parent | Merge branch '11.7' into 'master' (diff) | |
parent | add upstream 11.9 (diff) | |
download | FreeFileSync-8d28254d708c88ae4aaebbc82cbb6c91726aa390.tar.gz FreeFileSync-8d28254d708c88ae4aaebbc82cbb6c91726aa390.tar.bz2 FreeFileSync-8d28254d708c88ae4aaebbc82cbb6c91726aa390.zip |
Merge branch '11.9' into 'master'11.9
add upstream 11.9
See merge request opensource-tracking/FreeFileSync!32
Diffstat (limited to 'zen/socket.h')
-rw-r--r-- | zen/socket.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/zen/socket.h b/zen/socket.h index 2dd1ff4c..f9813852 100644 --- a/zen/socket.h +++ b/zen/socket.h @@ -14,6 +14,7 @@ #include <netdb.h> //getaddrinfo + namespace zen { #define THROW_LAST_SYS_ERROR_WSA(functionName) \ @@ -48,11 +49,15 @@ public: const auto getConnectedSocket = [](const auto& /*::addrinfo*/ ai) { - SocketType testSocket = ::socket(ai.ai_family, ai.ai_socktype, ai.ai_protocol); + SocketType testSocket = ::socket(ai.ai_family, //int socket_family + SOCK_CLOEXEC | + ai.ai_socktype, //int socket_type + ai.ai_protocol); //int protocol if (testSocket == invalidSocket) THROW_LAST_SYS_ERROR_WSA("socket"); ZEN_ON_SCOPE_FAIL(closeSocket(testSocket)); + if (::connect(testSocket, ai.ai_addr, static_cast<int>(ai.ai_addrlen)) != 0) THROW_LAST_SYS_ERROR_WSA("connect"); |