From 614c71c1ede56e88c4cc7280d4c13c9241df7c76 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Tue, 6 Aug 2013 15:52:31 +0200 Subject: [PATCH] Treat zero length object files as invalid Fix for bug 9972. --- ccache.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ccache.c b/ccache.c index 377bfa1..35506b0 100644 --- a/ccache.c +++ b/ccache.c @@ -1289,6 +1289,16 @@ from_cache(enum fromcache_call_mode mode, bool put_object_in_manifest) return; } + /* + * Occasionally eg. on hard reset our cache ends up as just + * fs meta-data with no content, catch an easy case of this. + */ + if (st.st_size == 0) { + cc_log("Invalid (empty) object file %s in cache", cached_obj); + x_unlink(cached_obj); + return; + } + /* Check if the diagnostic file is there. */ if (output_dia && stat(cached_dia, &st) != 0) { cc_log("Diagnostic file %s not in cache", cached_dia); -- 1.8.1.4