From: Nick Kew Date: Sun, 16 Jan 2011 04:22:25 +0000 (+0000) Subject: config: report error and exit cleanly if getaddrinfo fails at startup X-Git-Tag: 2.3.11~191 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eb8657d2160c48ca0269ce827eb883bf3d3fe8b2;p=thirdparty%2Fapache%2Fhttpd.git config: report error and exit cleanly if getaddrinfo fails at startup PR: 50592 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1059472 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/config.c b/server/config.c index 465ee59e102..00f51c8af7d 100644 --- a/server/config.c +++ b/server/config.c @@ -2209,7 +2209,12 @@ static server_rec *init_server_config(process_rec *process, apr_pool_t *p) /* NOT virtual host; don't match any real network interface */ rv = apr_sockaddr_info_get(&s->addrs->host_addr, NULL, APR_INET, 0, 0, p); - ap_assert(rv == APR_SUCCESS); /* otherwise: bug or no storage */ + if (rv != APR_SUCCESS) { + /* should we test here for rv being an EAIERR? */ + ap_log_error(APLOG_MARK, APLOG_STARTUP|APLOG_CRIT, rv, NULL, + "initialisation: bug or getaddrinfo fail"); + return NULL; + } s->addrs->host_port = 0; /* matches any port */ s->addrs->virthost = ""; /* must be non-NULL */ @@ -2235,6 +2240,9 @@ AP_DECLARE(server_rec*) ap_read_config(process_rec *process, apr_pool_t *ptemp, const char *confname, *error; apr_pool_t *p = process->pconf; server_rec *s = init_server_config(process, p); + if (s == NULL) { + return s; + } init_config_globals(p);