aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/local-binary-cache-store.cc
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2021-04-05 18:29:52 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2021-04-05 18:29:52 -0400
commite12308dd63f0ad27b22dcdb3da89c411eebcad2b (patch)
treece5a9b558ca9a2787e44614d7cd423f2d9318618 /src/libstore/local-binary-cache-store.cc
parentf0ad29acc1f2c9e82679c3af434a8bf185f36b94 (diff)
parenta07dc7e0d99d1cd91643c9ecc2b672399471eaf4 (diff)
Merge branch 'master' into path-info
Diffstat (limited to 'src/libstore/local-binary-cache-store.cc')
-rw-r--r--src/libstore/local-binary-cache-store.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libstore/local-binary-cache-store.cc b/src/libstore/local-binary-cache-store.cc
index a58b7733f..964c4017e 100644
--- a/src/libstore/local-binary-cache-store.cc
+++ b/src/libstore/local-binary-cache-store.cc
@@ -2,6 +2,8 @@
#include "globals.hh"
#include "nar-info-disk-cache.hh"
+#include <atomic>
+
namespace nix {
struct LocalBinaryCacheStoreConfig : virtual BinaryCacheStoreConfig
@@ -50,7 +52,8 @@ protected:
const std::string & mimeType) override
{
auto path2 = binaryCacheDir + "/" + path;
- Path tmp = path2 + ".tmp." + std::to_string(getpid());
+ static std::atomic<int> counter{0};
+ Path tmp = fmt("%s.tmp.%d.%d", path2, getpid(), ++counter);
AutoDelete del(tmp, false);
StreamToSourceAdapter source(istream);
writeFile(tmp, source);