aboutsummaryrefslogtreecommitdiffstats
path: root/irc.c
diff options
context:
space:
mode:
Diffstat (limited to 'irc.c')
-rw-r--r--irc.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/irc.c b/irc.c
index ebb2876b..5531addb 100644
--- a/irc.c
+++ b/irc.c
@@ -77,11 +77,6 @@ irc_t *irc_new( int fd )
{
irc->myhost = g_strdup( ipv6_unwrap( buf ) );
}
- else
- {
- /* Rare, but possible. */
- strncpy( irc->myhost, "localhost.localdomain", NI_MAXHOST );
- }
}
if( getpeername( irc->fd, (struct sockaddr*) &sock, &socklen ) == 0 )
@@ -93,13 +88,13 @@ irc_t *irc_new( int fd )
{
irc->host = g_strdup( ipv6_unwrap( buf ) );
}
- else
- {
- /* Rare, but possible. */
- strncpy( irc->host, "localhost.localdomain", NI_MAXHOST );
- }
}
+ if( irc->host == NULL )
+ irc->host = g_strdup( "localhost.localdomain" );
+ if( irc->myhost == NULL )
+ irc->myhost = g_strdup( "localhost.localdomain" );
+
if( global.conf->ping_interval > 0 && global.conf->ping_timeout > 0 )
irc->ping_source_id = b_timeout_add( global.conf->ping_interval * 1000, irc_userping, irc );