You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ni...@apache.org on 2011/01/16 05:22:26 UTC

svn commit: r1059472 - /httpd/httpd/trunk/server/config.c

Author: niq
Date: Sun Jan 16 04:22:25 2011
New Revision: 1059472

URL: http://svn.apache.org/viewvc?rev=1059472&view=rev
Log:
config: report error and exit cleanly if getaddrinfo fails at startup
PR: 50592

Modified:
    httpd/httpd/trunk/server/config.c

Modified: httpd/httpd/trunk/server/config.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/config.c?rev=1059472&r1=1059471&r2=1059472&view=diff
==============================================================================
--- httpd/httpd/trunk/server/config.c (original)
+++ httpd/httpd/trunk/server/config.c Sun Jan 16 04:22:25 2011
@@ -2209,7 +2209,12 @@ static server_rec *init_server_config(pr
     /* 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(p
     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);