From fb94e44c7ddc11b0b30612b3dd5f641973b9c8c7 Mon Sep 17 00:00:00 2001 From: Syping Date: Tue, 6 Feb 2024 16:25:04 +0100 Subject: [PATCH] rename working directory to storage directory --- src/database_file.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/database_file.cpp b/src/database_file.cpp index 54bbc40..227d12f 100644 --- a/src/database_file.cpp +++ b/src/database_file.cpp @@ -27,7 +27,7 @@ using namespace bot::database; file::file(const std::filesystem::path &storage_path) : m_storagePath(storage_path) { - std::cout << "[Launch] Checking working directory..." << std::endl; + std::cout << "[Launch] Checking storage directory..." << std::endl; if (!std::filesystem::exists(storage_path)) { std::cerr << "[Error] Storage directory " << storage_path << " can not be found" << std::endl; throw std::runtime_error("Storage directory can not be found"); @@ -48,6 +48,7 @@ file::file(const std::filesystem::path &storage_path) : m_storagePath(storage_pa throw std::system_error(errno, std::system_category()); } if (fcntl(fd, F_SETLK, &lock) == -1) { + close(fd); std::cerr << "[Error] Storage directory " << storage_path << " can not be locked" << std::endl; throw std::system_error(errno, std::system_category()); }