]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
fix(file-storage): Create CACHEDIR.TAG after subdir
authorJoel Rosdahl <joel@rosdahl.net>
Wed, 4 Aug 2021 19:51:33 +0000 (21:51 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Wed, 4 Aug 2021 19:51:33 +0000 (21:51 +0200)
Otherwise creation will fail the first time with an ugly log message.

src/storage/secondary/FileStorage.cpp

index 222825b485588ccc53351e466daa5a4890cf66bb..f5273ff85f2a0667ac0c307f8e62ab56097d9641 100644 (file)
@@ -126,14 +126,14 @@ FileStorageBackend::put(const Digest& key,
   {
     UmaskScope umask_scope(m_umask);
 
-    util::create_cachedir_tag(m_dir);
-
     const auto dir = Util::dir_name(path);
     if (!Util::create_dir(dir)) {
       LOG("Failed to create directory {}: {}", dir, strerror(errno));
       return nonstd::make_unexpected(Failure::error);
     }
 
+    util::create_cachedir_tag(m_dir);
+
     LOG("Writing {}", path);
     try {
       AtomicFile file(path, AtomicFile::Mode::binary);