about summary refs log tree commit diff
path: root/src/libstore
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2012-07-23T22·42-0400
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-07-23T22·42-0400
commite98c029717016dfa3e5c618c9fc46da9b2142dcc (patch)
tree77a1f6aa7366091f5d2fa3307839e960dbdc07c0 /src/libstore
parentfd63c8bfcd75624e7fbba8899365095400534e01 (diff)
Handle platforms that don't support linking to a symlink
E.g. Darwin doesn't allow this.
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/optimise-store.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/libstore/optimise-store.cc b/src/libstore/optimise-store.cc
index e5bfa332dcc7..486538bd29f6 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