fixed crashed if gethostbyaddr() fails on redirect

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@1718 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.14
Jan Kneschke 16 years ago
parent 10fbd9e24e
commit f1f11ba6ad

@ -148,7 +148,7 @@ int http_response_redirect_to_directory(server *srv, connection *con) {
char dst[INET6_ADDRSTRLEN];
log_error_write(srv, __FILE__, __LINE__,
"SSSS", "NOTICE: getnameinfo failed: ",
"SSS", "NOTICE: getnameinfo failed: ",
strerror(errno), ", using ip-address instead");
buffer_append_string(o,
@ -162,7 +162,7 @@ int http_response_redirect_to_directory(server *srv, connection *con) {
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: ",
"SdS", "NOTICE: gethostbyaddr failed: ",
h_errno, ", using ip-address instead");
buffer_append_string(o, inet_ntoa(our_addr.ipv4.sin_addr));

Loading…
Cancel
Save