Changeset 0cab388
- Timestamp:
- 2008-04-14T15:33:13Z (17 years ago)
- Branches:
- master
- Children:
- 4358b10
- Parents:
- b79308b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
dcc.c
rb79308b r0cab388 218 218 file_transfer_t *file = df->ft; 219 219 struct sockaddr_storage *saddr; 220 int fd ;220 int fd,gret; 221 221 char hostname[ HOST_NAME_MAX + 1 ]; 222 222 struct addrinfo hints, *rp; … … 231 231 hints.ai_flags = AI_NUMERICSERV; 232 232 233 if ( getaddrinfo( hostname, "0", &hints, &rp ) != 0)234 return dcc_abort( df, "getaddrinfo() ");233 if ( ( gret = getaddrinfo( hostname, "0", &hints, &rp ) != 0 ) ) 234 return dcc_abort( df, "getaddrinfo(): %s", gai_strerror( gret ) ); 235 235 236 236 saddr = g_new( struct sockaddr_storage, 1 ); … … 390 390 struct sockaddr_storage *saddr = &df->saddr; 391 391 int fd; 392 char ipaddr[INET6_ADDRSTRLEN]; 392 393 socklen_t sa_len = saddr->ss_family == AF_INET ? 393 394 sizeof( struct sockaddr_in ) : sizeof( struct sockaddr_in6 ); 394 395 395 396 if( !ft->write ) 396 return dcc_abort( df, " Protocol didn't register write()" );397 return dcc_abort( df, "BUG: protocol didn't register write()" ); 397 398 398 399 ASSERTSOCKOP( fd = df->fd = socket( saddr->ss_family, SOCK_STREAM, 0 ) , "Opening Socket" ); … … 402 403 if( ( connect( fd, (struct sockaddr *)saddr, sa_len ) == -1 ) && 403 404 ( errno != EINPROGRESS ) ) 404 return dcc_abort( df, "Connecting" ); 405 return dcc_abort( df, "Connecting to %s:%d : %s", 406 inet_ntop( saddr->ss_family, 407 saddr->ss_family == AF_INET ? 408 ( void* ) &( ( struct sockaddr_in *) saddr )->sin_addr.s_addr : 409 ( void* ) &( ( struct sockaddr_in6 *) saddr )->sin6_addr.s6_addr, 410 ipaddr, 411 sizeof( ipaddr ) ), 412 ntohs( saddr->ss_family == AF_INET ? 413 ( ( struct sockaddr_in *) saddr )->sin_port : 414 ( ( struct sockaddr_in6 *) saddr )->sin6_port ), 415 strerror( errno ) ); 405 416 406 417 ft->status = FT_STATUS_CONNECTING;
Note: See TracChangeset
for help on using the changeset viewer.