We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2e2198f commit 3bd7fa3Copy full SHA for 3bd7fa3
src/libstore/local-store.cc
@@ -212,16 +212,15 @@ LocalStore::LocalStore(
212
213
/* Ensure that the store and its parents are not symlinks. */
214
if (!settings.allowSymlinkedStore) {
215
- Path path = realStoreDir;
216
- struct stat st;
217
- while (path != "/") {
218
- st = lstat(path);
219
- if (S_ISLNK(st.st_mode))
+ std::filesystem::path path = realStoreDir.get();
+ std::filesystem::path root = path.root_path();
+ while (path != root) {
+ if (std::filesystem::is_symlink(path))
220
throw Error(
221
"the path '%1%' is a symlink; "
222
"this is not allowed for the Nix store and its parent directories",
223
path);
224
- path = dirOf(path);
+ path = path.parent_path();
225
}
226
227
0 commit comments