]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Using hardlinks if requested
authorChris AtLee <catlee@mozilla.com>
Fri, 29 Jul 2011 20:52:18 +0000 (16:52 -0400)
committerChris AtLee <catlee@mozilla.com>
Fri, 29 Jul 2011 20:52:18 +0000 (16:52 -0400)
ccache.c

index 2cd7323edbaaa25822d5f8c8913f9449a11b81ae..e3867bf831011a1e982e405158798087de41ed90 100644 (file)
--- a/ccache.c
+++ b/ccache.c
@@ -706,8 +706,14 @@ to_cache(struct args *args)
        }
 
        if (output_to_real_object_first) {
-               if (copy_file(tmp_obj, cached_obj, enable_compression) != 0) {
-                       cc_log("Failed to move %s to %s: %s", tmp_obj, cached_obj, strerror(errno));
+               int ret;
+               if (getenv("CCACHE_HARDLINK")) {
+                       ret = link(tmp_obj, cached_obj);
+               } else {
+                       ret = copy_file(tmp_obj, cached_obj, enable_compression);
+               }
+               if (ret != 0) {
+                       cc_log("Failed to copy/link %s to %s: %s", tmp_obj, cached_obj, strerror(errno));
                        stats_update(STATS_ERROR);
                        failed();
                }