diff options
author | 2001-05-03 17:16:12 +0000 | |
---|---|---|
committer | 2001-05-03 17:16:12 +0000 | |
commit | 665c437bf37c3d2cebe600e604482224ef009388 (patch) | |
tree | ea8da216de22c4bb1c068a15486c35bfe6ed0564 /usr.sbin/httpd/src | |
parent | exec shell -c /bin/sh .ssh/sshrc, from abartlet@pcug.org.au (diff) | |
download | wireguard-openbsd-665c437bf37c3d2cebe600e604482224ef009388.tar.xz wireguard-openbsd-665c437bf37c3d2cebe600e604482224ef009388.zip |
fix bug where apache would segfault on startup if localhost wasn't
defined for 127.0.0.1, thanks fgsch@
Diffstat (limited to 'usr.sbin/httpd/src')
-rw-r--r-- | usr.sbin/httpd/src/main/util.c | 16 |
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. */ |