diff options
author | Bob Beck <beck@cvs.openbsd.org> | 2001-05-03 17:16:13 +0000 |
---|---|---|
committer | Bob Beck <beck@cvs.openbsd.org> | 2001-05-03 17:16:13 +0000 |
commit | 9a9067f644216c0b9798c5766f6b36905b3bd8f2 (patch) | |
tree | 98d06b45b8f32b9e4fc17d04b63183e370deb736 /usr.sbin/httpd | |
parent | da970855f00492cb421ce9120df4ff09617219d0 (diff) |
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')
-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. */ |