1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-03 23:51:00 +01:00

libstore: Use makeTempPath in optimizePath_

This was intended to be cherry-picked in 6aed9d877c,
but was left hanging. This is actually important for fixing [^]. emilazy let me know
of this bad cherry-pick and its significance.

[^]: https://github.com/NixOS/nix/issues/7273

Originally fixed by Lily Ballard <lily@ballards.net> in https://gerrit.lix.systems/c/lix/+/2100.
This commit is contained in:
Sergei Zimmerman 2025-12-01 02:51:37 +03:00
parent 048a58d331
commit d888846b68
No known key found for this signature in database

View file

@ -234,7 +234,7 @@ void LocalStore::optimisePath_(
its timestamp back to 0. */ its timestamp back to 0. */
MakeReadOnly makeReadOnly(mustToggle ? dirOfPath : ""); MakeReadOnly makeReadOnly(mustToggle ? dirOfPath : "");
std::filesystem::path tempLink = fmt("%1%/.tmp-link-%2%-%3%", config->realStoreDir, getpid(), rand()); std::filesystem::path tempLink = makeTempPath(config->realStoreDir.get(), ".tmp-link");
try { try {
std::filesystem::create_hard_link(linkPath, tempLink); std::filesystem::create_hard_link(linkPath, tempLink);