diff options
author | Jean-Frederic Clere <jfclere@apache.org> | 2020-04-14 08:36:54 +0000 |
---|---|---|
committer | Jean-Frederic Clere <jfclere@apache.org> | 2020-04-14 08:36:54 +0000 |
commit | 6c8663602c9b3b821044a12963a365a030ae8526 (patch) | |
tree | 3ff43d41cbf5d23e1dd0d1ccdb64d71b90d1826a | |
parent | 04a380566db2f7027b2859720ce7d2e17a59b06a (diff) | |
download | httpd-6c8663602c9b3b821044a12963a365a030ae8526.tar.gz |
PR64313 htcacheclean: Empty directories in CacheRoot are still present even after using "-t"
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1876484 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | support/htcacheclean.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/support/htcacheclean.c b/support/htcacheclean.c index aac1cd61fd..938a8cca57 100644 --- a/support/htcacheclean.c +++ b/support/htcacheclean.c @@ -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; } |