diff options
Diffstat (limited to 'zen/socket.h')
-rw-r--r-- | zen/socket.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/zen/socket.h b/zen/socket.h index 5ece29f8..d9517bd8 100644 --- a/zen/socket.h +++ b/zen/socket.h @@ -33,11 +33,13 @@ class Socket //throw SysError public: Socket(const Zstring& server, const Zstring& serviceName) //throw SysError { - ::addrinfo hints = {}; - hints.ai_socktype = SOCK_STREAM; //we *do* care about this one! - hints.ai_flags = AI_ADDRCONFIG; //save a AAAA lookup on machines that can't use the returned data anyhow + const addrinfo hints + { + .ai_flags = AI_ADDRCONFIG, //save a AAAA lookup on machines that can't use the returned data anyhow + .ai_socktype = SOCK_STREAM, //we *do* care about this one! + }; - ::addrinfo* servinfo = nullptr; + addrinfo* servinfo = nullptr; ZEN_ON_SCOPE_EXIT(if (servinfo) ::freeaddrinfo(servinfo)); const int rcGai = ::getaddrinfo(server.c_str(), serviceName.c_str(), &hints, &servinfo); |