diff --git a/lix/libstore/build/derivation-goal.cc b/lix/libstore/build/derivation-goal.cc index f72a51a9d..d369a9fd6 100644 --- a/lix/libstore/build/derivation-goal.cc +++ b/lix/libstore/build/derivation-goal.cc @@ -761,11 +761,7 @@ void replaceValidPath(const Path & storePath, const Path & tmpPath) we're repairing (say) Glibc, we end up with a broken system. */ Path oldPath; if (pathExists(storePath)) { - do { - oldPath = makeTempSiblingPath(storePath); - // store paths are often directories so we can't just unlink() it - // let's make sure the path doesn't exist before we try to use it - } while (pathExists(oldPath)); + oldPath = makeTempSiblingPath(storePath); movePath(storePath, oldPath); } diff --git a/lix/libstore/gc.cc b/lix/libstore/gc.cc index d46de9d84..3b3c2a687 100644 --- a/lix/libstore/gc.cc +++ b/lix/libstore/gc.cc @@ -42,7 +42,6 @@ static void makeSymlink(const Path & link, const Path & target) /* Create the new symlink. */ Path tempLink = makeTempPath(link); - unlink(tempLink.c_str()); // just in case; ignore errors createSymlink(target, tempLink); /* Atomically replace the old one. */ @@ -97,7 +96,7 @@ void LocalStore::createTempRootsFile() /* Create the temporary roots file for this process. */ while (true) { - auto tmp = makeTempPath(fnTempRoots, ".tmp"); + auto tmp = makeTempPath(fnTempRoots); AutoCloseFD fd{open(tmp.c_str(), O_RDWR | O_CREAT | O_EXCL | O_CLOEXEC, 0600)}; if (!fd && errno != EEXIST) { throw SysError("opening lock file '%1%'", tmp); diff --git a/lix/libstore/optimise-store.cc b/lix/libstore/optimise-store.cc index d34f08441..6270dcc8e 100644 --- a/lix/libstore/optimise-store.cc +++ b/lix/libstore/optimise-store.cc @@ -218,8 +218,7 @@ void LocalStore::optimisePath_(Activity * act, OptimiseStats & stats, its timestamp back to 0. */ MakeReadOnly makeReadOnly(mustToggle ? dirOfPath : ""); - Path tempLink = makeTempPath(config().realStoreDir, "/.tmp-link"); - unlink(tempLink.c_str()); // just in case; ignore errors + Path tempLink = makeTempPath(config().realStoreDir + "/"); if (link(linkPath.c_str(), tempLink.c_str()) == -1) { if (errno == EMLINK) {