]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Don’t fail fatally if temporary cpp_stderr file is missing
authorJoel Rosdahl <joel@rosdahl.net>
Mon, 21 Oct 2019 18:06:22 +0000 (20:06 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Tue, 22 Oct 2019 19:12:01 +0000 (21:12 +0200)
If the temporary cpp_stderr file is missing when the compilation command
has finished then either some user removed it or ccache removed it in
clean_up_internal_tempdir (since the compilation took more than hour or
the system clock was adjusted?). In either case, let’s just fall back to
running the real compiler instead of failing fatally.

Fixes #480 and #154.

(cherry picked from commit c74dbfe5d43fc23733bd44839b9bd119da94ba26)

src/ccache.cpp

index a4549719ed10e6cdc8b3be7815afbcbf69f92140..51be84429a19490f65dcf5fa1852a55272a93d45 100644 (file)
@@ -1598,7 +1598,10 @@ get_result_name_from_cpp(struct args* args, struct hash* hash)
 
   hash_delimiter(hash, "cppstderr");
   if (!direct_i_file && !hash_file(hash, path_stderr)) {
-    fatal("Failed to open %s: %s", path_stderr, strerror(errno));
+    // Somebody removed the temporary file?
+    stats_update(STATS_ERROR);
+    cc_log("Failed to open %s: %s", path_stderr, strerror(errno));
+    failed();
   }
 
   if (direct_i_file) {