Always use SOCK_CLOEXEC in tcp client

This commit is contained in:
Gabi Melman 2020-03-13 01:18:27 +02:00 committed by GitHub
parent 1389f86675
commit 2b0481deed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -75,11 +75,7 @@ public:
int last_errno = 0; int last_errno = 0;
for (auto *rp = addrinfo_result; rp != nullptr; rp = rp->ai_next) for (auto *rp = addrinfo_result; rp != nullptr; rp = rp->ai_next)
{ {
#ifdef SPDLOG_PREVENT_CHILD_FD
int const flags = SOCK_CLOEXEC; int const flags = SOCK_CLOEXEC;
#else
int const flags = 0;
#endif
socket_ = ::socket(rp->ai_family, rp->ai_socktype | flags, rp->ai_protocol); socket_ = ::socket(rp->ai_family, rp->ai_socktype | flags, rp->ai_protocol);
if (socket_ == -1) if (socket_ == -1)
{ {