summaryrefslogtreecommitdiff
path: root/cleanup.c
diff options
context:
space:
mode:
authorJoel Rosdahl <joel@rosdahl.net>2009-12-12 21:27:11 +0100
committerJoel Rosdahl <joel@rosdahl.net>2010-01-05 18:53:03 +0100
commit59eb6b9fc3c3835328ff1aa828bd234b8ce72de0 (patch)
treef4b1da999b5a4deafa4fa518e7ac12e18b1ef203 /cleanup.c
parent5de11867ce6efd5ab45746184b0c19faa2b49e75 (diff)
downloadccache-59eb6b9fc3c3835328ff1aa828bd234b8ce72de0.tar.gz
Don't create empty stderr files in the cache
Diffstat (limited to 'cleanup.c')
-rw-r--r--cleanup.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/cleanup.c b/cleanup.c
index b82ccfb9..170b625d 100644
--- a/cleanup.c
+++ b/cleanup.c
@@ -129,8 +129,21 @@ static void sort_and_clean(void)
}
if (is_object_file(files[i]->fname)) {
+ char *path;
+
total_object_files -= 1;
total_object_size -= files[i]->size;
+
+ /*
+ * If we have deleted an object file, we should delete
+ * any .stderr and .d file as well.
+ */
+ x_asprintf(&path, "%s.stderr", files[i]->fname);
+ unlink(path);
+ free(path);
+ x_asprintf(&path, "%s.d", files[i]->fname);
+ unlink(path);
+ free(path);
}
}
}