From 2a2647bb650cd916243d32780f9de375561323b4 Mon Sep 17 00:00:00 2001 From: Andreas Joachim Peters Date: Tue, 11 Jun 2024 16:07:13 +0200 Subject: [PATCH] XrdApps::JCache: remove also the parent directory of journal files --- src/XrdApps/XrdClJCachePlugin/cleaner/Cleaner.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/XrdApps/XrdClJCachePlugin/cleaner/Cleaner.cc b/src/XrdApps/XrdClJCachePlugin/cleaner/Cleaner.cc index dfb625c1a08..da3e57d0e68 100644 --- a/src/XrdApps/XrdClJCachePlugin/cleaner/Cleaner.cc +++ b/src/XrdApps/XrdClJCachePlugin/cleaner/Cleaner.cc @@ -126,6 +126,12 @@ void Cleaner::cleanDirectory(const fs::path &directory, long long highWatermark, try { fs::remove(filePath); currentSize -= fileSize; + fs::path parentDir = filePath.parent_path(); + std::error_code ec; + fs::remove_all(parentDir, ec); + if (ec) { + mLog->Error(1, "JCache::Cleaner: error deleting directory '%s'", parentDir.c_str()); + } mLog->Info(1, "JCache:Cleaner : deleted '%s' (Size: %lu bytes)", filePath.c_str(), fileSize); } catch (const std::exception &e) {