summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/httpd/src/main/util.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/usr.sbin/httpd/src/main/util.c b/usr.sbin/httpd/src/main/util.c
index fb3347f96c4..c39adb1191d 100644
--- a/usr.sbin/httpd/src/main/util.c
+++ b/usr.sbin/httpd/src/main/util.c
@@ -2047,12 +2047,16 @@ char *ap_get_local_host(pool *a)
str[sizeof(str) - 1] = '\0';
if ((!(p = gethostbyname(str)))
|| (!(server_hostname = find_fqdn(a, p)))) {
- /* Recovery - return the default servername by IP: */
- if (p->h_addr_list[0]) {
- ap_snprintf(str, sizeof(str), "%pA", p->h_addr_list[0]);
- server_hostname = ap_pstrdup(a, str);
- /* We will drop through to report the IP-named server */
- }
+ if (!p)
+ server_hostname=NULL;
+ else {
+ /* Recovery - return the default servername by IP: */
+ if (p->h_addr_list[0]) {
+ ap_snprintf(str, sizeof(str), "%pA", p->h_addr_list[0]);
+ server_hostname = ap_pstrdup(a, str);
+ /* We will drop through to report the IP-named server */
+ }
+ }
}
else
/* Since we found a fdqn, return it with no logged message. */