Changeset 1717

Show
Ignore:
Timestamp:
03/26/2007 08:20:32 AM (17 months ago)
Author:
jan
Message:

fixed crash if a gethostbyname() failed

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/http-header-glue.c

    r1675 r1717  
    154154                                char dst[INET6_ADDRSTRLEN]; 
    155155 
    156                                 log_error_write(srv, __FILE__, __LINE__, 
    157                                                 "SSSS", "NOTICE: getnameinfo failed: ", 
    158                                                 strerror(errno), ", using ip-address instead"); 
     156                                ERROR("NOTICE: getnameinfo() failed: %s, using ip-address instead", 
     157                                                strerror(errno)); 
    159158 
    160159                                buffer_append_string(o, 
     
    168167                case AF_INET: 
    169168                        if (NULL == (he = gethostbyaddr((char *)&our_addr.ipv4.sin_addr, sizeof(struct in_addr), AF_INET))) { 
    170                                 log_error_write(srv, __FILE__, __LINE__, 
    171                                                 "SdSS", "NOTICE: gethostbyaddr failed: ", 
    172                                                 h_errno, ", using ip-address instead"); 
     169                                ERROR("NOTICE: gethostbyaddr() failed: %d, using ip-address instead", 
     170                                                h_errno); 
    173171 
    174172                                buffer_append_string(o, inet_ntoa(our_addr.ipv4.sin_addr)); 
     
    178176                        break; 
    179177                default: 
    180                         log_error_write(srv, __FILE__, __LINE__, 
    181                                         "S", "ERROR: unsupported address-type"); 
     178                        ERROR("ERROR: unsupported address-type, %d", our_addr.plain.sa_family); 
    182179 
    183180                        buffer_free(o);