From: Jeff Trawick Date: Mon, 1 Apr 2002 12:53:09 +0000 (+0000) Subject: Don't allow initialization to succeed if we can't get a socket X-Git-Tag: 2.0.35~82 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3010b21372bd849715def86ee7635868e1119531;p=apache Don't allow initialization to succeed if we can't get a socket corresponding to one of the Listen statements. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94358 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index c23af1e7dd..7fd5937a27 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,8 @@ +Changes with Apache 2.0.35 + + *) Don't allow initialization to succeed if we can't get a socket + corresponding to one of the Listen statements. [Jeff Trawick] + Changes with Apache 2.0.34 *) Allow all Perchild directives to accept either numerical UID/GID diff --git a/server/listen.c b/server/listen.c index 8e0a539dd4..7f0c32c048 100644 --- a/server/listen.c +++ b/server/listen.c @@ -238,7 +238,7 @@ static void find_default_family(apr_pool_t *p) } -static void alloc_listener(process_rec *process, char *addr, apr_port_t port) +static const char *alloc_listener(process_rec *process, char *addr, apr_port_t port) { ap_listen_rec **walk; ap_listen_rec *new; @@ -278,7 +278,7 @@ static void alloc_listener(process_rec *process, char *addr, apr_port_t port) *walk = new->next; new->next = ap_listeners; ap_listeners = new; - return; + return NULL; } } } @@ -292,7 +292,7 @@ static void alloc_listener(process_rec *process, char *addr, apr_port_t port) ap_log_perror(APLOG_MARK, APLOG_CRIT, status, process->pool, "alloc_listener: failed to set up sockaddr for %s", addr); - return; + return "Listen setup failed"; } if ((status = apr_socket_create(&new->sd, new->bind_addr->family, @@ -300,11 +300,12 @@ static void alloc_listener(process_rec *process, char *addr, apr_port_t port) != APR_SUCCESS) { ap_log_perror(APLOG_MARK, APLOG_CRIT, status, process->pool, "alloc_listener: failed to get a socket for %s", addr); - return; + return "Listen setup failed"; } new->next = ap_listeners; ap_listeners = new; + return NULL; } static int ap_listen_open(apr_pool_t *pool, apr_port_t port) @@ -401,9 +402,7 @@ const char *ap_set_listener(cmd_parms *cmd, void *dummy, const char *ips) return "Port must be specified"; } - alloc_listener(cmd->server->process, host, port); - - return NULL; + return alloc_listener(cmd->server->process, host, port); } const char *ap_set_listenbacklog(cmd_parms *cmd, void *dummy, const char *arg)