mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user