aboutsummaryrefslogtreecommitdiff
path: root/CCache/stats.c
diff options
context:
space:
mode:
authorWilliam Fulton <william@wheezy>2013-05-19 00:44:06 +0100
committerWilliam Fulton <william@wheezy>2013-05-19 00:59:28 +0100
commit4ba9365e0f398b9cec0dbb9f8950b23e47507c28 (patch)
tree41ca202f99b73f390f42f3143f16204dc4a626f9 /CCache/stats.c
parent04b9037c707f3fd179ded0648fa654aa9c95a2a8 (diff)
downloadswig-4ba9365e0f398b9cec0dbb9f8950b23e47507c28.tar.gz
Fix ccache-swig internal error bug due to premature file cleanup
Fixes SF bug 1319 which shows up as a failure in the ccache tests on Debian 64 bit Wheezy, possibly because ENABLE_ZLIB is defined. This bug is due to files being too aggressively cleaned up part way through the caching. The .stderr file is cached and then retrieved from the cache for displaying to stderr. However, the stats are updated between caching and using the .stderr file. During the stats update the cache is cleaned and the newly cached files can be removed if the max number of files per directory is low. Really the cache should be cleaned up at exit to solve this (as is done in ccache-3.1). The workaround fix ensures the cached files are ignored during cleanup, which is a bit tricky as sometimes files from a previous run have the same time stamp, so that don't appear to be the oldest in the cache.
Diffstat (limited to 'CCache/stats.c')
-rw-r--r--CCache/stats.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/CCache/stats.c b/CCache/stats.c
index 92bc4a835..d2122bcd3 100644
--- a/CCache/stats.c
+++ b/CCache/stats.c
@@ -168,7 +168,8 @@ static void stats_update_size(enum stats stat, size_t size, size_t numfiles)
if (need_cleanup) {
char *p = dirname(stats_file);
- cleanup_dir(p, counters[STATS_MAXFILES], counters[STATS_MAXSIZE]);
+ cleanup_dir(p, counters[STATS_MAXFILES], counters[STATS_MAXSIZE],
+ numfiles);
free(p);
}
}