]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Handle disappearing temporary stdout file gracefully
authorJoel Rosdahl <joel@rosdahl.net>
Sat, 5 Jan 2013 17:10:36 +0000 (18:10 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Sat, 5 Jan 2013 17:37:47 +0000 (18:37 +0100)
If the temporary stdout file has disappeared, it's most likely because
another ccache process is doing cleanup on a too small cache.

ccache.c

index 50137d3980a1f90b8be460dd43a97db08a0fa12c..02dbdfab89150bdf2d4f349b815cdcd7b8fe642d 100644 (file)
--- a/ccache.c
+++ b/ccache.c
@@ -2,7 +2,7 @@
  * ccache -- a fast C/C++ compiler cache
  *
  * Copyright (C) 2002-2007 Andrew Tridgell
- * Copyright (C) 2009-2012 Joel Rosdahl
+ * Copyright (C) 2009-2013 Joel Rosdahl
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the Free
@@ -551,7 +551,13 @@ to_cache(struct args *args)
        args_pop(args, 3);
 
        if (stat(tmp_stdout, &st) != 0) {
-               fatal("Could not create %s (permission denied?)", tmp_stdout);
+               /* The stdout file was removed - cleanup in progress? Better bail out. */
+               cc_log("%s not found: %s", tmp_stdout, strerror(errno));
+               stats_update(STATS_MISSING);
+               tmp_unlink(tmp_stdout);
+               tmp_unlink(tmp_stderr);
+               tmp_unlink(tmp_obj);
+               failed();
        }
        if (st.st_size != 0) {
                cc_log("Compiler produced stdout");