aboutsummaryrefslogtreecommitdiffstats
path: root/dcc.c
diff options
context:
space:
mode:
authorulim <a.sporto+bee@gmail.com>2008-04-14 14:59:15 +0200
committerulim <a.sporto+bee@gmail.com>2008-04-14 14:59:15 +0200
commit6cac643f6933e431b90fcb937dec505f989e6a53 (patch)
treedd8555d790c54897800ebfa091fd48a270912f84 /dcc.c
parent2625d6de47df4054f793990118fa99f3d04d694f (diff)
more verbose error logging
Diffstat (limited to 'dcc.c')
-rw-r--r--dcc.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/dcc.c b/dcc.c
index 2fa3f745..fa5a0f76 100644
--- a/dcc.c
+++ b/dcc.c
@@ -583,11 +583,17 @@ file_transfer_t *dcc_request( struct im_connection *ic, char *line )
regex_t re;
file_transfer_t *ft;
dcc_file_transfer_t *df;
-
- if( regcomp( &re, pattern, REG_EXTENDED ) )
- return NULL;
- if( regexec( &re, line, 9, pmatch, 0 ) )
+ char errbuf[256];
+ int regerrcode, gret;
+
+ if( ( regerrcode = regcomp( &re, pattern, REG_EXTENDED ) ) ||
+ ( regerrcode = regexec( &re, line, 9, pmatch, 0 ) ) ) {
+ regerror( regerrcode,&re,errbuf,sizeof( errbuf ) );
+ imcb_log( ic,
+ "DCC: error parsing 'DCC SEND': %s, line: %s",
+ errbuf, line );
return NULL;
+ }
if( ( pmatch[1].rm_so > 0 ) &&
( pmatch[4].rm_so > 0 ) &&
@@ -615,7 +621,7 @@ file_transfer_t *dcc_request( struct im_connection *ic, char *line )
/* number means ipv4, something else means ipv6 */
if ( pmatch[5].rm_so > 0 )
{
- struct in_addr ipaddr = { htonl( atoi( input + pmatch[5].rm_so ) ) };
+ struct in_addr ipaddr = { .s_addr = htonl( atoi( input + pmatch[5].rm_so ) ) };
host = inet_ntoa( ipaddr );
} else
{
@@ -630,9 +636,13 @@ file_transfer_t *dcc_request( struct im_connection *ic, char *line )
filesize = atoll( input + pmatch[8].rm_so );
memset( &hints, 0, sizeof ( struct addrinfo ) );
- if ( getaddrinfo( host, port, &hints, &rp ) )
+ if ( ( gret = getaddrinfo( host, port, &hints, &rp ) ) )
{
g_free( input );
+ imcb_log( ic, "DCC: getaddrinfo() failed with %s "
+ "when parsing incoming 'DCC SEND': "
+ "host %s, port %s",
+ gai_strerror( gret ), host, port );
return NULL;
}
@@ -649,6 +659,8 @@ file_transfer_t *dcc_request( struct im_connection *ic, char *line )
return ft;
}
+ imcb_log( ic, "DCC: couldnt parse 'DCC SEND' line: %s", line );
+
return NULL;
}