Update to latest Csocket

We are using a vanilla version of Csocket again. Previously, our copy of
Csocket.h had a new '#include "zncconfig.h"'.

The other changes are mostly cleanup for various compiler warnings. The switch
from inet_ntoa() to inet_ntop() is for thread-safety reasons.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter
2011-02-18 11:56:39 +01:00
parent 32e89efa95
commit cc552fb3f5
3 changed files with 12 additions and 12 deletions

View File

@@ -1594,10 +1594,14 @@ CS_STRING Csock::GetLocalIP()
if( !GetIPv6() )
{
char straddr[INET_ADDRSTRLEN];
struct sockaddr_in mLocalAddr;
socklen_t mLocalLen = sizeof( mLocalAddr );
if ( getsockname( iSock, (struct sockaddr *) &mLocalAddr, &mLocalLen ) == 0 )
m_sLocalIP = inet_ntoa( mLocalAddr.sin_addr );
if ( ( getsockname( iSock, (struct sockaddr *) &mLocalAddr, &mLocalLen ) == 0 )
&& ( inet_ntop( AF_INET, &mLocalAddr.sin_addr, straddr, sizeof(straddr) ) ) )
{
m_sLocalIP = straddr;
}
}
#ifdef HAVE_IPV6
else