diff options
Diffstat (limited to 'third_party/nix/src/libstore/local-fs-store.cc')
-rw-r--r-- | third_party/nix/src/libstore/local-fs-store.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/third_party/nix/src/libstore/local-fs-store.cc b/third_party/nix/src/libstore/local-fs-store.cc index d9eaea2e93a8..bc282eac96b9 100644 --- a/third_party/nix/src/libstore/local-fs-store.cc +++ b/third_party/nix/src/libstore/local-fs-store.cc @@ -16,9 +16,10 @@ struct LocalStoreAccessor : public FSAccessor { Path toRealPath(const Path& path) { Path storePath = store->toStorePath(path); - if (!store->isValidPath(storePath)) + if (!store->isValidPath(storePath)) { throw InvalidPath(format("path '%1%' is not a valid store path") % storePath); + } return store->getRealStoreDir() + std::string(path, store->storeDir.size()); } @@ -27,13 +28,15 @@ struct LocalStoreAccessor : public FSAccessor { struct stat st; if (lstat(realPath.c_str(), &st)) { - if (errno == ENOENT || errno == ENOTDIR) + if (errno == ENOENT || errno == ENOTDIR) { return {Type::tMissing, 0, false}; + } throw SysError(format("getting status of '%1%'") % path); } - if (!S_ISREG(st.st_mode) && !S_ISDIR(st.st_mode) && !S_ISLNK(st.st_mode)) + if (!S_ISREG(st.st_mode) && !S_ISDIR(st.st_mode) && !S_ISLNK(st.st_mode)) { throw Error(format("file '%1%' has unsupported type") % path); + } return {S_ISREG(st.st_mode) ? Type::tRegular |