From 3f8920c4b584f44d18aec2d28de571f5b4b167cf Mon Sep 17 00:00:00 2001 From: olavmrk Date: Fri, 22 Mar 2013 11:43:56 +0000 Subject: 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 --- auth_mellon_util.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 { -- cgit