]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
make sure we cleanup any tmp files leftover from dead ccache runs
authorAndrew Tridgell <tridge@samba.org>
Mon, 17 Jul 2006 01:09:56 +0000 (03:09 +0200)
committerAndrew Tridgell <tridge@samba.org>
Mon, 17 Jul 2006 01:09:56 +0000 (03:09 +0200)
cleanup.c

index 99312283ebccf1df1ed581e88b01605795eb21b7..33aa386137da537c20d8b9f9b32c27d9118c72c6 100644 (file)
--- 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) {