diff --git a/Csocket.cpp b/Csocket.cpp index e1341f77..1fcacbfb 100644 --- a/Csocket.cpp +++ b/Csocket.cpp @@ -69,10 +69,13 @@ int GetHostByName6( const CS_STRING & sHostName, in6_addr * paddr, u_int iNumRet iReturn = HOST_NOT_FOUND; #else hent = gethostbyname2( sHostName.c_str(), AF_INET6 ); - PERROR( "gethostbyname" ); if ( hent ) iReturn = 0; + else + { + PERROR( "gethostbyname2" ); + } #endif /* __linux__ */ @@ -110,10 +113,13 @@ int GetHostByName( const CS_STRING & sHostName, in_addr * paddr, u_int iNumRetri iReturn = HOST_NOT_FOUND; #else hent = gethostbyname( sHostName.c_str() ); - PERROR( "gethostbyname" ); if ( hent ) iReturn = 0; + else + { + PERROR( "gethostbyname" ); + } #endif /* __linux__ */ @@ -1862,7 +1868,7 @@ int Csock::DNSLookup( EDNSLType eDNSLType ) #ifdef HAVE_IPV6 else { - iRet = GetHostByName6( m_shostname, m_bindhost.GetAddr6(), 1 ); + iRet = GetHostByName6( m_shostname, m_address.GetAddr6(), 1 ); } #endif /* HAVE_IPV6 */ } diff --git a/Csocket.h b/Csocket.h index 077e8c23..f246f5df 100644 --- a/Csocket.h +++ b/Csocket.h @@ -95,7 +95,7 @@ #ifndef CS_DEBUG #ifdef __DEBUG__ -# define CS_DEBUG( f ) std::cerr << __FILE__ << ":" << __LINE__ << " " << f << endl +# define CS_DEBUG( f ) std::cerr << __FILE__ << ":" << __LINE__ << " " << f << std::endl #else # define CS_DEBUG(f) (void)0 #endif /* __DEBUG__ */ @@ -125,7 +125,7 @@ public: m_bIsIPv6 = false; memset( (struct sockaddr_in *)&m_saddr, '\0', sizeof( m_saddr ) ); #ifdef HAVE_IPV6 - memset( (struct sockaddr_in6 *)&m_saddr, '\0', sizeof( m_saddr6 ) ); + memset( (struct sockaddr_in6 *)&m_saddr6, '\0', sizeof( m_saddr6 ) ); #endif /* HAVE_IPV6 */ } virtual ~CSSockAddr() {}