]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
PR64313 htcacheclean: Empty directories in CacheRoot are still present even after...
authorJean-Frederic Clere <jfclere@apache.org>
Tue, 14 Apr 2020 08:36:54 +0000 (08:36 +0000)
committerJean-Frederic Clere <jfclere@apache.org>
Tue, 14 Apr 2020 08:36:54 +0000 (08:36 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1876484 13f79535-47bb-0310-9956-ffa450edef68

support/htcacheclean.c

index aac1cd61fd0f9249afc9fd9d41b7b370845a690b..938a8cca57e926d983ec03f9c529e02bee2aaa53 100644 (file)
@@ -685,9 +685,18 @@ static int process_dir(char *path, apr_pool_t *pool, apr_off_t *nodes)
         }
 
         if (info.filetype == APR_DIR) {
+            char *dirpath=apr_pstrdup(p, d->basename);
             if (process_dir(d->basename, pool, nodes)) {
                 return 1;
             }
+            /* When given the -t option htcacheclean does not
+             * delete directories that are already empty, so we'll do that here
+             * since process_dir checks all the directories.
+             * If it fails, it likely means there was something else there.
+             */
+            if (deldirs && !dryrun) {
+                apr_dir_remove(dirpath,p);
+            }
             continue;
         }