]> 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>
Mon, 21 Oct 2019 18:09:07 +0000 (20:09 +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.

src/ccache.c

index 533a5de77526427d7e334bd5a47c1e4615325615..edfc8ca52fd032e83a04370c05d3eb83849e50a9 100644 (file)
@@ -1720,7 +1720,10 @@ get_object_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) {