about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-05-02T13·07+0200
committerEelco Dolstra <edolstra@gmail.com>2017-05-02T13·46+0200
commitc5bea16611ae1aa99680bbd5d94bc69811869885 (patch)
treee6db0308cb4b12c3e5cb9f8830000c5ab1ce8ab9
parent7f6837a0f6e7702a9e8c6da622873b955aa414cd (diff)
LocalStoreAccessor: Fix handling of diverted stores
-rw-r--r--src/libstore/local-fs-store.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libstore/local-fs-store.cc b/src/libstore/local-fs-store.cc
index bf247903c9db..bf28a1c70c62 100644
--- a/src/libstore/local-fs-store.cc
+++ b/src/libstore/local-fs-store.cc
@@ -31,7 +31,7 @@ struct LocalStoreAccessor : public FSAccessor
         auto realPath = toRealPath(path);
 
         struct stat st;
-        if (lstat(path.c_str(), &st)) {
+        if (lstat(realPath.c_str(), &st)) {
             if (errno == ENOENT || errno == ENOTDIR) return {Type::tMissing, 0, false};
             throw SysError(format("getting status of ‘%1%’") % path);
         }
@@ -51,7 +51,7 @@ struct LocalStoreAccessor : public FSAccessor
     {
         auto realPath = toRealPath(path);
 
-        auto entries = nix::readDirectory(path);
+        auto entries = nix::readDirectory(realPath);
 
         StringSet res;
         for (auto & entry : entries)
@@ -73,7 +73,8 @@ struct LocalStoreAccessor : public FSAccessor
 
 ref<FSAccessor> LocalFSStore::getFSAccessor()
 {
-    return make_ref<LocalStoreAccessor>(ref<LocalFSStore>(std::dynamic_pointer_cast<LocalFSStore>(shared_from_this())));
+    return make_ref<LocalStoreAccessor>(ref<LocalFSStore>(
+            std::dynamic_pointer_cast<LocalFSStore>(shared_from_this())));
 }
 
 void LocalFSStore::narFromPath(const Path & path, Sink & sink)