]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Fix command-line processing so that if a bad argument is specified
authorJeff Trawick <trawick@apache.org>
Fri, 18 May 2001 11:42:10 +0000 (11:42 +0000)
committerJeff Trawick <trawick@apache.org>
Fri, 18 May 2001 11:42:10 +0000 (11:42 +0000)
Apache will exit.

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

CHANGES
server/main.c

diff --git a/CHANGES b/CHANGES
index 1a45636cf22b6a26137fdacd2946b425074bc3dd..f61dc4eabc09055d0bad10799fc5e1c3d01ce323 100644 (file)
--- 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]
      
index ad71b60d2b0178ffd902816c7a35ec489d572efa..3aabc7184aa7d9a69d5a66655635a969a0cb0d12 100644 (file)
@@ -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);