From: Chris AtLee Date: Fri, 29 Jul 2011 20:52:18 +0000 (-0400) Subject: Using hardlinks if requested X-Git-Tag: v3.2~178^2~4^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8252a80d0e91940c64821b781494d00feb26831a;p=thirdparty%2Fccache.git Using hardlinks if requested --- diff --git a/ccache.c b/ccache.c index 2cd7323ed..e3867bf83 100644 --- 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(); }