From c898a46cb5123ee1f854f5bab2a500b871f94568 Mon Sep 17 00:00:00 2001 From: Chiaki ISHIKAWA Date: Tue, 10 Mar 2015 22:23:48 +0900 Subject: [PATCH 6/8] warning about missing x_unlinks when get_file_from_cache() failed. --- ccache.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/ccache.c b/ccache.c index 02a0d76..92bfb21 100644 --- a/ccache.c +++ b/ccache.c @@ -1533,14 +1533,42 @@ from_cache(enum fromcache_call_mode mode, bool put_object_in_manifest) if (!str_eq(output_obj, "/dev/null")) { get_file_from_cache(cached_obj, output_obj); cc_log("Created (output_obj) %s from (cached_obj) %s", output_obj, cached_obj); + /* + * if something failed internal to get_file_from_cache we may + * want to remove some files: the following x_unlink calls + * were in the original code circa 2014 summer. + * + * Similar comments are repeated in code below. + * + * Does failed(), which is called when error exit is taken, + * handle this now? If so, this comment is superflous. + * + * if (output_dwo) x_unlink(output_dwo); + * if (cached_dwo) x_unlink(cached_dwo); + * x_unlink(output_obj); + * x_unlink(cached_stderr); + * x_unlink(cached_obj); + * x_unlink(cached_dep); + *x_unlink(cached_dia); + */ } if (produce_dep_file) { get_file_from_cache(cached_dep, output_dep); cc_log("Created (output_dep) %s from (cached_dep) %s", output_dep, cached_dep); + /* + * Note: if something failed internal to get_file_from_cache + * we may want to remove a flurry of files. + * There were calls to x_unlinks in the original code circa 2014 summer. + */ } if (output_dia) { get_file_from_cache(cached_dia, output_dia); cc_log("Created (output_dia) %s from (cached_dia) %s", output_dia, cached_dia); + /* + * Note: if something failed internal to get_file_from_cache + * we may want to remove a flurry of files. + * There were calls to x_unlinks in the original code circa 2014 summer. + */ } /* Update modification timestamps to save files from LRU cleanup. -- 2.1.4