]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Include .tmp. in AtomicFile names
authorJoel Rosdahl <joel@rosdahl.net>
Mon, 30 Sep 2019 18:34:56 +0000 (20:34 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Sat, 5 Oct 2019 21:16:46 +0000 (23:16 +0200)
This makes it possible to use AtomicFile for files in the cache
directory without having to add a “.tmp” interfix explicitly.

src/AtomicFile.cpp

index 4063c21ca378ba0f3e42c529461471f945cb1686..6edc1157ebdaf8e4b1a9f7887418c9b5b61b1e06 100644 (file)
@@ -29,7 +29,7 @@
 
 AtomicFile::AtomicFile(const std::string& path, Mode mode) : m_path(path)
 {
-  auto fd_and_path = Util::create_temp_fd(path);
+  auto fd_and_path = Util::create_temp_fd(path + ".tmp");
   m_stream = fdopen(fd_and_path.first, mode == Mode::binary ? "w+b" : "w+");
   m_tmp_path = std::move(fd_and_path.second);
 }