]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
config: report error and exit cleanly if getaddrinfo fails at startup
authorNick Kew <niq@apache.org>
Sun, 16 Jan 2011 04:22:25 +0000 (04:22 +0000)
committerNick Kew <niq@apache.org>
Sun, 16 Jan 2011 04:22:25 +0000 (04:22 +0000)
PR: 50592

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1059472 13f79535-47bb-0310-9956-ffa450edef68

server/config.c

index 465ee59e1025f8b728d037e6e9723f991937c353..00f51c8af7d96b1ec550a88ca0597e07b4f87879 100644 (file)
@@ -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);