summaryrefslogtreecommitdiff
path: root/manifest.c
diff options
context:
space:
mode:
authorJoel Rosdahl <joel@rosdahl.net>2014-11-08 16:53:34 +0100
committerJoel Rosdahl <joel@rosdahl.net>2014-11-13 19:50:13 +0100
commita07f46a3b0f7e452d50690b831bb4c99fbc6650f (patch)
tree65062f5d3ed14d9f627764a8537c8e0d9974b1e8 /manifest.c
parent1df910958f8e75126d273f06285a52493ebb331f (diff)
downloadccache-a07f46a3b0f7e452d50690b831bb4c99fbc6650f.tar.gz
Do not rely on pids being unique
Based on a patch by Mike Frysinger <vapier@gentoo.org>: "Linux supports creating pid namespaces cheaply and running processes inside of them. When you try to share a single cache among multiple such runs, the fact that the code relies on pid numbers as globally unique values quickly fails. Instead, switch to standard mkstemp to generate temp files for us."
Diffstat (limited to 'manifest.c')
-rw-r--r--manifest.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/manifest.c b/manifest.c
index 7977418b..660d437f 100644
--- a/manifest.c
+++ b/manifest.c
@@ -653,7 +653,7 @@ manifest_put(const char *manifest_path, struct file_hash *object_hash,
}
tmp_file = format("%s.tmp.%s", manifest_path, tmp_string());
- fd2 = safe_open(tmp_file);
+ fd2 = mkstemp(tmp_file);
if (fd2 == -1) {
cc_log("Failed to open %s", tmp_file);
goto out;