Changeset 6cac643


Ignore:
Timestamp:
2008-04-14T12:59:15Z (16 years ago)
Author:
ulim <a.sporto+bee@…>
Branches:
master
Children:
b79308b
Parents:
2625d6d
Message:

more verbose error logging

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • dcc.c

    r2625d6d r6cac643  
    584584        file_transfer_t *ft;
    585585        dcc_file_transfer_t *df;
    586 
    587         if( regcomp( &re, pattern, REG_EXTENDED ) )
     586        char errbuf[256];
     587        int regerrcode, gret;
     588
     589        if( ( regerrcode = regcomp( &re, pattern, REG_EXTENDED ) ) ||
     590            ( regerrcode = regexec( &re, line, 9, pmatch, 0 ) ) ) {
     591                regerror( regerrcode,&re,errbuf,sizeof( errbuf ) );
     592                imcb_log( ic,
     593                          "DCC: error parsing 'DCC SEND': %s, line: %s",
     594                          errbuf, line );
    588595                return NULL;
    589         if( regexec( &re, line, 9, pmatch, 0 ) )
    590                 return NULL;
     596        }
    591597
    592598        if( ( pmatch[1].rm_so > 0 ) &&
     
    616622                if ( pmatch[5].rm_so > 0 )
    617623                {
    618                         struct in_addr ipaddr = { htonl( atoi( input + pmatch[5].rm_so ) ) };
     624                        struct in_addr ipaddr = { .s_addr = htonl( atoi( input + pmatch[5].rm_so ) ) };
    619625                        host = inet_ntoa( ipaddr );
    620626                } else
     
    631637
    632638                memset( &hints, 0, sizeof ( struct addrinfo ) );
    633                 if ( getaddrinfo( host, port, &hints, &rp ) )
     639                if ( ( gret = getaddrinfo( host, port, &hints, &rp ) ) )
    634640                {
    635641                        g_free( input );
     642                        imcb_log( ic, "DCC: getaddrinfo() failed with %s "
     643                                  "when parsing incoming 'DCC SEND': "
     644                                  "host %s, port %s",
     645                                  gai_strerror( gret ), host, port );
    636646                        return NULL;
    637647                }
     
    650660        }
    651661
     662        imcb_log( ic, "DCC: couldnt parse 'DCC SEND' line: %s", line );
     663
    652664        return NULL;
    653665}
  • protocols/jabber/s5bytestream.c

    r2625d6d r6cac643  
    353353        struct bs_transfer *bt = data;
    354354        short revents;
     355        int gret;
    355356
    356357        if ( ( fd != 0 ) && !jabber_bs_poll( bt, fd, &revents ) )
     
    366367                        hints.ai_socktype = SOCK_STREAM;
    367368
    368                         if ( getaddrinfo( bt->sh->host, bt->sh->port, &hints, &rp ) != 0 )
    369                                 return jabber_bs_abort( bt, "getaddrinfo() failed: %s", strerror( errno ) );
     369                        if ( ( gret = getaddrinfo( bt->sh->host, bt->sh->port, &hints, &rp ) ) != 0 )
     370                                return jabber_bs_abort( bt, "getaddrinfo() failed: %s", gai_strerror( gret ) );
    370371
    371372                        ASSERTSOCKOP( bt->tf->fd = fd = socket( rp->ai_family, rp->ai_socktype, 0 ), "Opening socket" );
     
    923924{
    924925        struct jabber_transfer *tf = bt->tf;
    925         int fd;
     926        int fd,gret;
    926927        char hostname[ HOST_NAME_MAX + 1 ];
    927928        struct addrinfo hints, *rp;
     
    936937        hints.ai_flags = AI_NUMERICSERV;
    937938
    938         if ( getaddrinfo( hostname, "0", &hints, &rp ) != 0 )
    939                 return jabber_bs_abort( bt, "getaddrinfo()" );
     939        if ( ( gret = getaddrinfo( hostname, "0", &hints, &rp ) ) != 0 )
     940                return jabber_bs_abort( bt, "getaddrinfo() failed: %s", gai_strerror( gret ) );
    940941
    941942        memcpy( saddr, rp->ai_addr, rp->ai_addrlen );
Note: See TracChangeset for help on using the changeset viewer.