From: Jeff Trawick Date: Tue, 16 Oct 2001 18:45:16 +0000 (+0000) Subject: Exit when we can't listen on any of the configured ports. This X-Git-Tag: 2.0.27~126 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b9c5fa38be1a0db9f5e068617b05ab101de1c2de;p=thirdparty%2Fapache%2Fhttpd.git Exit when we can't listen on any of the configured ports. This is the same behavior as 1.3, and it avoids having the MPMs to deal with bogus ap_listen_rec structures. This also backs out some circumventions I and Greg Ames had added to prefork; these are no longer necessary because of this change. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91494 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 0872d99ffb7..35a447f18bc 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,9 @@ Changes with Apache 2.0.27-dev + *) Exit when we can't listen on any of the configured ports. This + is the same behavior as 1.3, and it avoids having the MPMs to + deal with bogus ap_listen_rec structures. [Jeff Trawick] + *) Cleanup the proxy code that creates a request to the origin server. This change adds an optional hook, which allows modules to gain control while the request is created if the proxy module diff --git a/server/listen.c b/server/listen.c index 8068dce659e..6a6e919a7fa 100644 --- a/server/listen.c +++ b/server/listen.c @@ -287,6 +287,10 @@ int ap_listen_open(process_rec *process, apr_port_t port) ++num_open; lr->active = 1; } + else { + /* fatal error */ + return -1; + } } } diff --git a/server/mpm/prefork/prefork.c b/server/mpm/prefork/prefork.c index b2903441f31..e19c7968de0 100644 --- a/server/mpm/prefork/prefork.c +++ b/server/mpm/prefork/prefork.c @@ -663,14 +663,12 @@ static void child_main(int child_num_arg) } first_lr=lr; do { - if (lr->active) { - apr_os_sock_get(&sockdes, lr->sd); - if (FD_ISSET(sockdes, &main_fds)) - goto got_listener; - lr = lr->next; - if (!lr) - lr = ap_listeners; - } + apr_os_sock_get(&sockdes, lr->sd); + if (FD_ISSET(sockdes, &main_fds)) + goto got_listener; + lr = lr->next; + if (!lr) + lr = ap_listeners; } while (lr != first_lr); /* FIXME: if we get here, something bad has happened, and we're @@ -1090,12 +1088,10 @@ static int setup_listeners(server_rec *s) listenmaxfd = -1; FD_ZERO(&listenfds); for (lr = ap_listeners; lr; lr = lr->next) { - if (lr->active) { - apr_os_sock_get(&sockdes, lr->sd); - FD_SET(sockdes, &listenfds); - if (sockdes > listenmaxfd) { - listenmaxfd = sockdes; - } + apr_os_sock_get(&sockdes, lr->sd); + FD_SET(sockdes, &listenfds); + if (sockdes > listenmaxfd) { + listenmaxfd = sockdes; } } return 0;