]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Wipe the whole cached result on failure retrieving a cached file
authorJoel Rosdahl <joel@rosdahl.net>
Mon, 16 Mar 2015 21:31:33 +0000 (22:31 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Mon, 16 Mar 2015 21:31:33 +0000 (22:31 +0100)
As suggested by Chiaki ISHIKAWA <ishikawa@yk.rim.or.jp>.

ccache.c

index 44383d1bd0e122a8c0d411f2559f4309c230e9d2..5e904d814335e2d92acbed993ebb779f2f112042 100644 (file)
--- a/ccache.c
+++ b/ccache.c
@@ -723,6 +723,14 @@ get_file_from_cache(const char *source, const char *dest)
                               strerror(errno));
                        stats_update(STATS_ERROR);
                }
+
+               /* If there was trouble getting a file from the cached result, wipe the
+                * whole cached result for consistency. */
+               x_unlink(cached_stderr);
+               x_unlink(cached_obj);
+               x_unlink(cached_dep);
+               x_unlink(cached_dia);
+
                failed();
        }