httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cove...@apache.org
Subject svn commit: r816906 - in /httpd/httpd/branches/2.2.x: CHANGES STATUS support/htcacheclean.c
Date Sat, 19 Sep 2009 12:28:59 GMT
Author: covener
Date: Sat Sep 19 12:28:58 2009
New Revision: 816906

URL: http://svn.apache.org/viewvc?rev=816906&view=rev
Log:
Merge r814091, r814779, r81544, r816701 from trunk:

htcacheclean: 19 ways to fail, 1 error message. Fixed.
  Move declaration to remove a compiler warning.
  Detab.

Submitted by: minfrin, trawick
Reviewed by: minfrin, poirier, covener


Modified:
    httpd/httpd/branches/2.2.x/CHANGES
    httpd/httpd/branches/2.2.x/STATUS
    httpd/httpd/branches/2.2.x/support/htcacheclean.c

Modified: httpd/httpd/branches/2.2.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/CHANGES?rev=816906&r1=816905&r2=816906&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.2.x/CHANGES [utf-8] Sat Sep 19 12:28:58 2009
@@ -9,6 +9,8 @@
      mod_proxy_ftp: NULL pointer dereference on error paths.
      [Stefan Fritsch <sf fritsch.de>, Joe Orton]
 
+  *) htcacheclean: 19 ways to fail, 1 error message. Fixed. [Graham Leggett]
+
   *) mod_ldap: Bring the LDAPCacheEntries and LDAPOpCacheEntries
      usage() in synch with the manual and the implementation (0 and -1
      both disable the cache). [Eric Covener]

Modified: httpd/httpd/branches/2.2.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/STATUS?rev=816906&r1=816905&r2=816906&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/STATUS (original)
+++ httpd/httpd/branches/2.2.x/STATUS Sat Sep 19 12:28:58 2009
@@ -89,13 +89,6 @@
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
- * htcacheclean: 19 ways to fail, 1 error message. Fixed.
-   Trunk Patch: http://svn.apache.org/viewvc?view=rev&revision=814091
-                http://svn.apache.org/viewvc?view=rev&revision=814779
-                http://svn.apache.org/viewvc?rev=815448&view=rev
-                http://svn.apache.org/viewvc?view=rev&revision=816701
-   +1: minfrin, poirier, covener
-
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
   [ New proposals should be added at the end of the list ]
 

Modified: httpd/httpd/branches/2.2.x/support/htcacheclean.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/support/htcacheclean.c?rev=816906&r1=816905&r2=816906&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/support/htcacheclean.c (original)
+++ httpd/httpd/branches/2.2.x/support/htcacheclean.c Sat Sep 19 12:28:58 2009
@@ -697,9 +697,12 @@
  * usage info
  */
 #define NL APR_EOL_STR
-static void usage(void)
+static void usage(const char *error)
 {
-    apr_file_printf(errfile,
+    if (error) {
+    	apr_file_printf(errfile, "%s error: %s\n", shortname, error);
+    }
+	apr_file_printf(errfile,
     "%s -- program for cleaning the disk cache."                             NL
     "Usage: %s [-Dvtrn] -pPATH -lLIMIT"                                      NL
     "       %s [-nti] -dINTERVAL -pPATH -lLIMIT"                             NL
@@ -758,6 +761,7 @@
     char opt;
     const char *arg;
     char *proxypath, *path;
+    char errmsg[1024];
 
     interrupted = 0;
     repeat = 0;
@@ -798,48 +802,48 @@
             break;
         }
         else if (status != APR_SUCCESS) {
-            usage();
+            usage(NULL);
         }
         else {
             switch (opt) {
             case 'i':
                 if (intelligent) {
-                    usage();
+                    usage(apr_psprintf(pool, "The option '%c' cannot be specified more than
once", (int)opt));
                 }
                 intelligent = 1;
                 break;
 
             case 'D':
                 if (dryrun) {
-                    usage();
+                    usage(apr_psprintf(pool, "The option '%c' cannot be specified more than
once", (int)opt));
                 }
                 dryrun = 1;
                 break;
 
             case 'n':
                 if (benice) {
-                    usage();
+                    usage(apr_psprintf(pool, "The option '%c' cannot be specified more than
once", (int)opt));
                 }
                 benice = 1;
                 break;
 
             case 't':
                 if (deldirs) {
-                    usage();
+                    usage(apr_psprintf(pool, "The option '%c' cannot be specified more than
once", (int)opt));
                 }
                 deldirs = 1;
                 break;
 
             case 'v':
                 if (verbose) {
-                    usage();
+                    usage(apr_psprintf(pool, "The option '%c' cannot be specified more than
once", (int)opt));
                 }
                 verbose = 1;
                 break;
 
             case 'r':
                 if (realclean) {
-                    usage();
+                    usage(apr_psprintf(pool, "The option '%c' cannot be specified more than
once", (int)opt));
                 }
                 realclean = 1;
                 deldirs = 1;
@@ -847,7 +851,7 @@
 
             case 'd':
                 if (isdaemon) {
-                    usage();
+                    usage(apr_psprintf(pool, "The option '%c' cannot be specified more than
once", (int)opt));
                 }
                 isdaemon = 1;
                 repeat = apr_atoi64(arg);
@@ -857,7 +861,7 @@
 
             case 'l':
                 if (limit_found) {
-                    usage();
+                    usage(apr_psprintf(pool, "The option '%c' cannot be specified more than
once", (int)opt));
                 }
                 limit_found = 1;
 
@@ -882,44 +886,57 @@
                         }
                     }
                     if (rv != APR_SUCCESS) {
-                        apr_file_printf(errfile, "Invalid limit: %s"
-                                                 APR_EOL_STR APR_EOL_STR, arg);
-                        usage();
+                        usage(apr_psprintf(pool, "Invalid limit: %s"
+                                                 APR_EOL_STR APR_EOL_STR, arg));
                     }
                 } while(0);
                 break;
 
             case 'p':
                 if (proxypath) {
-                    usage();
+                    usage(apr_psprintf(pool, "The option '%c' cannot be specified more than
once", (int)opt));
                 }
                 proxypath = apr_pstrdup(pool, arg);
-                if (apr_filepath_set(proxypath, pool) != APR_SUCCESS) {
-                    usage();
+                if ((status = apr_filepath_set(proxypath, pool)) != APR_SUCCESS) {
+                    usage(apr_psprintf(pool, "Could not set filepath to '%s': %s",
+                                       proxypath, apr_strerror(status, errmsg, sizeof errmsg)));
                 }
                 break;
             } /* switch */
         } /* else */
     } /* while */
 
+    if (argc <= 1) {
+        usage(NULL);
+    }
+
     if (o->ind != argc) {
-         usage();
+         usage("Additional parameters specified on the command line, aborting");
     }
 
-    if (isdaemon && (repeat <= 0 || verbose || realclean || dryrun)) {
-         usage();
+    if (isdaemon && repeat <= 0) {
+         usage("Option -d must be greater than zero");
+    }
+
+    if (isdaemon && (verbose || realclean || dryrun)) {
+         usage("Option -d cannot be used with -v, -r or -D");
     }
 
     if (!isdaemon && intelligent) {
-         usage();
+         usage("Option -i cannot be used without -d");
+    }
+
+    if (!proxypath) {
+         usage("Option -p must be specified");
     }
 
-    if (!proxypath || max <= 0) {
-         usage();
+    if (max <= 0) {
+         usage("Option -l must be greater than zero");
     }
 
     if (apr_filepath_get(&path, 0, pool) != APR_SUCCESS) {
-        usage();
+        usage(apr_psprintf(pool, "Could not get the filepath: %s",
+                           apr_strerror(status, errmsg, sizeof errmsg)));
     }
     baselen = strlen(path);
 



Mime
View raw message