diff options
author | Joel Rosdahl <joel@rosdahl.net> | 2014-11-08 16:53:34 +0100 |
---|---|---|
committer | Joel Rosdahl <joel@rosdahl.net> | 2014-11-13 19:50:13 +0100 |
commit | a07f46a3b0f7e452d50690b831bb4c99fbc6650f (patch) | |
tree | 65062f5d3ed14d9f627764a8537c8e0d9974b1e8 /manifest.c | |
parent | 1df910958f8e75126d273f06285a52493ebb331f (diff) | |
download | ccache-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.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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; |