From dce4338e3369815187497ef1c1360bc41109c0bc Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Wed, 4 Aug 2021 21:51:33 +0200 Subject: [PATCH] fix(file-storage): Create CACHEDIR.TAG after subdir Otherwise creation will fail the first time with an ugly log message. --- src/storage/secondary/FileStorage.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/storage/secondary/FileStorage.cpp b/src/storage/secondary/FileStorage.cpp index 222825b48..f5273ff85 100644 --- a/src/storage/secondary/FileStorage.cpp +++ b/src/storage/secondary/FileStorage.cpp @@ -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); -- 2.47.2