From 8f5e718c1f21408a8fbb60f2263a0ef6a9147487 Mon Sep 17 00:00:00 2001 From: Chiaki ISHIKAWA Date: Wed, 11 Mar 2015 00:32:58 +0900 Subject: [PATCH 8/8] Missing copy of diagnostics file in case of failure? --- ccache.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/ccache.c b/ccache.c index 2ad5e80..f4d8565 100644 --- a/ccache.c +++ b/ccache.c @@ -951,6 +951,38 @@ to_cache(struct args *args) close(fd); tmp_unlink(tmp_stderr); + /* Copying of _dia file should be done here since when + * an error occurs, we may want to know the + * diagnostics, don't we? + * As it turns out since we now generate always first in the final destination + * the following code is not necessary (?). + * I comment it out using #if 0/#endif for now. + */ +#if 0 + if (output_dia) { + int ret; + x_unlink(output_dia); + /* only make a hardlink if the cache file is uncompressed */ + ret = move_file(tmp_dia, output_dia, 0); + + if (ret == -1) { + if (errno == ENOENT) { + /* Someone removed the file just before we began copying? */ + cc_log("Diagnostic file %s just disappeared", output_dia); + stats_update(STATS_MISSING); + } else { + cc_log("Failed to move %s to %s: %s", + tmp_dia, output_dia, strerror(errno)); + stats_update(STATS_ERROR); + failed(); + } + x_unlink(tmp_dia); + } else { + cc_log("Created %s from %s", output_dia, tmp_dia); + } + } +#endif + exit(status); } -- 2.1.4