Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
edolstra committed Jul 8, 2020
1 parent 34f2512 commit b981e5a
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/libstore/local-store.cc
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,7 @@ void LocalStore::addToStore(const ValidPathInfo & info, Source & source,

PathLocks outputLock;

Path realPath = realStoreDir + "/" + std::string(info.path.to_string());
auto realPath = Store::toRealPath(info.path);

/* Lock the output path. But don't lock if we're being called
from a build hook (whose parent process already acquired a
Expand Down Expand Up @@ -1047,8 +1047,7 @@ StorePath LocalStore::addToStoreFromDump(const string & dump, const string & nam
/* The first check above is an optimisation to prevent
unnecessary lock acquisition. */

Path realPath = realStoreDir + "/";
realPath += dstPath.to_string();
auto realPath = Store::toRealPath(dstPath);

PathLocks outputLock({realPath});

Expand Down Expand Up @@ -1167,7 +1166,7 @@ StorePath LocalStore::addToStore(const string & name, const Path & _srcPath,

Hash hash = hashSink ? hashSink->finish().first : sha256.first;

Path dstPath = makeFixedOutputPath(method, hash, name);
auto dstPath = makeFixedOutputPath(method, hash, name);

addTempRoot(dstPath);

Expand All @@ -1176,7 +1175,7 @@ StorePath LocalStore::addToStore(const string & name, const Path & _srcPath,
/* The first check above is an optimisation to prevent
unnecessary lock acquisition. */

Path realPath = realStoreDir + "/" + baseNameOf(dstPath);
auto realPath = Store::toRealPath(dstPath);

PathLocks outputLock({realPath});

Expand Down Expand Up @@ -1224,8 +1223,7 @@ StorePath LocalStore::addTextToStore(const string & name, const string & s,

if (repair || !isValidPath(dstPath)) {

Path realPath = realStoreDir + "/";
realPath += dstPath.to_string();
auto realPath = Store::toRealPath(dstPath);

PathLocks outputLock({realPath});

Expand Down

0 comments on commit b981e5a

Please sign in to comment.