From 5b9c3ce38ff3bc3741cb07b9e9b27fbab2bfe25c Mon Sep 17 00:00:00 2001 From: Syping Date: Tue, 13 Feb 2024 00:13:07 +0100 Subject: [PATCH] remove unnecessary call --- src/database_file.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/database_file.cpp b/src/database_file.cpp index 5f042fd..19ec400 100644 --- a/src/database_file.cpp +++ b/src/database_file.cpp @@ -60,17 +60,11 @@ file::file(const std::filesystem::path &storage_path) : m_storagePath(storage_pa } #elif defined(_WIN32) const std::filesystem::path lock_file = storage_path / ".lock"; - fh = CreateFileW(lock_file.c_str(), GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_HIDDEN, NULL); if (fh == INVALID_HANDLE_VALUE) { std::cerr << "[Error] Storage directory " << storage_path << " can not be locked" << std::endl; throw std::system_error(GetLastError(), std::system_category()); } - if (!LockFile(fh, NULL, NULL, NULL, NULL)) { - CloseHandle(fh); - std::cerr << "[Error] Storage directory " << storage_path << " can not be locked" << std::endl; - throw std::system_error(GetLastError(), std::system_category()); - } #endif }