From 7a7b869fe16842e2dc5c714b3f873ff39b53bec5 Mon Sep 17 00:00:00 2001 From: Jeff Trawick Date: Fri, 18 May 2001 11:42:10 +0000 Subject: [PATCH] Fix command-line processing so that if a bad argument is specified Apache will exit. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89150 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 3 +++ server/main.c | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 1a45636cf2..f61dc4eabc 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,8 @@ Changes with Apache 2.0.18-dev + *) Fix command-line processing so that if a bad argument is specified + Apache will exit. [Jeff Trawick] + *) Change the make targets and rules to be consistent in all of the Apache-owned source trees. [Roy Fielding] diff --git a/server/main.c b/server/main.c index ad71b60d2b..3aabc7184a 100644 --- a/server/main.c +++ b/server/main.c @@ -294,6 +294,7 @@ int main(int argc, const char * const argv[]) apr_pool_t *ptemp; /* Pool for temporary config stuff, reset often */ apr_pool_t *pcommands; /* Pool for -D, -C and -c switches */ apr_getopt_t *opt; + apr_status_t rv; module **mod; const char *optarg; @@ -324,7 +325,7 @@ int main(int argc, const char * const argv[]) */ apr_getopt_init(&opt, pcommands, process->argc, process->argv); - while (apr_getopt(opt, AP_SERVER_BASEARGS, &c, &optarg) + while ((rv = apr_getopt(opt, AP_SERVER_BASEARGS, &c, &optarg)) == APR_SUCCESS) { char **new; switch (c) { @@ -362,12 +363,15 @@ int main(int argc, const char * const argv[]) case 't': configtestonly = 1; break; - case '?': case 'h': usage(process); } } + if (rv != APR_EOF) { /* bad cmdline option */ + usage(process); + } + apr_pool_create(&plog, pglobal); apr_pool_create(&ptemp, pconf); -- 2.40.0