]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Handle non-writable CCACHE_DIR gracefully
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 11 Sep 2011 19:01:28 +0000 (21:01 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 11 Sep 2011 19:01:28 +0000 (21:01 +0200)
ccache.c

index 3bb6d77c3829ca99e0cdfcfc51a5df265d343ca6..7e0db22f5ce09db382e69ef5f24afbdf40320af3 100644 (file)
--- a/ccache.c
+++ b/ccache.c
@@ -1824,6 +1824,14 @@ ccache(int argc, char *argv[])
                failed();
        }
 
+       if (!getenv("CCACHE_READONLY")) {
+               if (create_cachedirtag(cache_dir) != 0) {
+                       cc_log("failed to create %s/CACHEDIR.TAG (%s)\n",
+                               cache_dir, strerror(errno));
+                       failed();
+               }
+       }
+
        sloppiness = parse_sloppiness(getenv("CCACHE_SLOPPINESS"));
 
        cc_log_argv("Command line: ", argv);
@@ -2176,15 +2184,6 @@ ccache_main(int argc, char *argv[])
                exit(1);
        }
 
-       if (!getenv("CCACHE_READONLY")) {
-               if (create_cachedirtag(cache_dir) != 0) {
-                       fprintf(stderr,
-                               "ccache: failed to create %s/CACHEDIR.TAG (%s)\n",
-                               cache_dir, strerror(errno));
-                       exit(1);
-               }
-       }
-
        ccache(argc, argv);
        return 1;
 }