From e98c029717016dfa3e5c618c9fc46da9b2142dcc Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 23 Jul 2012 18:42:18 -0400 Subject: Handle platforms that don't support linking to a symlink E.g. Darwin doesn't allow this. --- src/libstore/optimise-store.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/libstore/optimise-store.cc b/src/libstore/optimise-store.cc index e5bfa332d..486538bd2 100644 --- a/src/libstore/optimise-store.cc +++ b/src/libstore/optimise-store.cc @@ -62,8 +62,13 @@ void LocalStore::optimisePath_(OptimiseStats & stats, const Path & path) return; } - /* We can hard link regular files and symlinks. */ - if (!S_ISREG(st.st_mode) && !S_ISLNK(st.st_mode)) return; + /* We can hard link regular files and maybe symlinks. */ + if (!S_ISREG(st.st_mode) +#if CAN_LINK_SYMLINK + x + && !S_ISLNK(st.st_mode) +#endif + ) return; /* Sometimes SNAFUs can cause files in the Nix store to be modified, in particular when running programs as root under -- cgit v1.2.3