From: Andrew Tridgell Date: Mon, 17 Jul 2006 01:09:56 +0000 (+0200) Subject: make sure we cleanup any tmp files leftover from dead ccache runs X-Git-Tag: v3.0pre0~196 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b826a4d9c1a7fd6af134fbc6fd6328686c745ee2;p=thirdparty%2Fccache.git make sure we cleanup any tmp files leftover from dead ccache runs --- diff --git a/cleanup.c b/cleanup.c index 99312283e..33aa38613 100644 --- a/cleanup.c +++ b/cleanup.c @@ -57,6 +57,17 @@ static void traverse_fn(const char *fname, struct stat *st) free(p); return; } + + if (strstr(fname, ".tmp.") != NULL) { + /* delete any tmp files older than 1 hour */ + if (st->st_mtime + 3600 < time(NULL)) { + unlink(fname); + free(p); + return; + } + } + + free(p); if (num_files == allocated) {