summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorolavmrk <olavmrk@a716ebb1-153a-0410-b759-cfb97c6a1b53>2013-03-22 11:43:56 +0000
committerolavmrk <olavmrk@a716ebb1-153a-0410-b759-cfb97c6a1b53>2013-03-22 11:43:56 +0000
commit3f8920c4b584f44d18aec2d28de571f5b4b167cf (patch)
tree43fa93a0a329e5f4e181f1625f9f0e6e2f66cbe2
parent1e6f81f03a98c4f80906b56ba40114d7dcd46c15 (diff)
downloadmod_auth_mellon-3f8920c4b584f44d18aec2d28de571f5b4b167cf.zip
mod_auth_mellon-3f8920c4b584f44d18aec2d28de571f5b4b167cf.tar.gz
mod_auth_mellon-3f8920c4b584f44d18aec2d28de571f5b4b167cf.tar.xz
Fix repost data expiration.
We were mixing microseconds and seconds, causing us to always delete all the repost data. This patch fixes the comparison, and also optimizes it a bit. Thanks to Matthew Slowe for diagnosing this bug! git-svn-id: https://modmellon.googlecode.com/svn/trunk@201 a716ebb1-153a-0410-b759-cfb97c6a1b53
-rw-r--r--auth_mellon_util.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/auth_mellon_util.c b/auth_mellon_util.c
index 3c0a5d9..0fd31e2 100644
--- a/auth_mellon_util.c
+++ b/auth_mellon_util.c
@@ -929,9 +929,13 @@ int am_postdir_cleanup(request_rec *r)
apr_finfo_t afi;
char *fname;
int count;
+ apr_time_t expire_before;
mod_cfg = am_get_mod_cfg(r->server);
+ /* The oldes file we should keep. Delete files that are older. */
+ expire_before = apr_time_now() - mod_cfg->post_ttl * APR_USEC_PER_SEC;
+
/*
* Open our POST directory or create it.
*/
@@ -957,7 +961,7 @@ int am_postdir_cleanup(request_rec *r)
if (afi.name[0] == '.')
continue;
- if (afi.ctime + mod_cfg->post_ttl > apr_time_sec(apr_time_now())) {
+ if (afi.ctime < expire_before) {
fname = apr_psprintf(r->pool, "%s/%s", mod_cfg->post_dir, afi.name);
(void)apr_file_remove(fname , r->pool);
} else {