diff options
author | jan <jan@152afb58-edef-0310-8abb-c4023f1b3aa9> | 2007-03-26 08:20:32 +0000 |
---|---|---|
committer | jan <jan@152afb58-edef-0310-8abb-c4023f1b3aa9> | 2007-03-26 08:20:32 +0000 |
commit | 0d61a46a3c3fbe5bfcc13267176680190cce5b81 (patch) | |
tree | 8f729b101d119f1ce1b5f4ec6c4ae00aeba0b59a | |
parent | 1791da51a0e13be76846f6b3ecf6ee6bb903a896 (diff) | |
download | lighttpd-0d61a46a3c3fbe5bfcc13267176680190cce5b81.tar.gz |
fixed crash if a gethostbyname() failed
git-svn-id: svn://svn.lighttpd.net/lighttpd/trunk@1717 152afb58-edef-0310-8abb-c4023f1b3aa9
-rw-r--r-- | src/http-header-glue.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/http-header-glue.c b/src/http-header-glue.c index b7e9fabc..67e16681 100644 --- a/src/http-header-glue.c +++ b/src/http-header-glue.c @@ -153,9 +153,8 @@ int http_response_redirect_to_directory(server *srv, connection *con) { char dst[INET6_ADDRSTRLEN]; - log_error_write(srv, __FILE__, __LINE__, - "SSSS", "NOTICE: getnameinfo failed: ", - strerror(errno), ", using ip-address instead"); + ERROR("NOTICE: getnameinfo() failed: %s, using ip-address instead", + strerror(errno)); buffer_append_string(o, inet_ntop(AF_INET6, (char *)&our_addr.ipv6.sin6_addr, @@ -167,9 +166,8 @@ int http_response_redirect_to_directory(server *srv, connection *con) { #endif case AF_INET: if (NULL == (he = gethostbyaddr((char *)&our_addr.ipv4.sin_addr, sizeof(struct in_addr), AF_INET))) { - log_error_write(srv, __FILE__, __LINE__, - "SdSS", "NOTICE: gethostbyaddr failed: ", - h_errno, ", using ip-address instead"); + ERROR("NOTICE: gethostbyaddr() failed: %d, using ip-address instead", + h_errno); buffer_append_string(o, inet_ntoa(our_addr.ipv4.sin_addr)); } else { @@ -177,8 +175,7 @@ int http_response_redirect_to_directory(server *srv, connection *con) { } break; default: - log_error_write(srv, __FILE__, __LINE__, - "S", "ERROR: unsupported address-type"); + ERROR("ERROR: unsupported address-type, %d", our_addr.plain.sa_family); buffer_free(o); return -1; |