fix
Some checks reported errors
BlockStorage/repertory/pipeline/head Something is wrong with the build of this commit

This commit is contained in:
2024-08-28 17:43:13 -05:00
parent e6bd5834f8
commit 6cae320556
3 changed files with 18 additions and 42 deletions

View File

@@ -510,14 +510,10 @@ auto winfsp_drive::GetSecurityByName(PWSTR file_name, PUINT32 attributes,
std::uint64_t sds = descriptor_size == nullptr ? 0U : *descriptor_size;
auto ret = get_security_by_name(file_name, attributes, descriptor,
sds > 0U ? &sds : nullptr);
if (attributes != nullptr) {
event_system::instance().raise<debug_log>(
std::string{function_name}, api_path,
std::to_string(*attributes & FILE_ATTRIBUTE_DIRECTORY));
}
if (sds != 0U) {
*descriptor_size = static_cast<SIZE_T>(sds);
}
RAISE_WINFSP_EVENT(function_name, api_path, ret);
return ret;
}
@@ -713,8 +709,6 @@ auto winfsp_drive::Open(PWSTR file_name, UINT32 create_options,
std::uint64_t handle{};
std::shared_ptr<i_open_file> file;
error = fm_->open(api_path, directory, ofd, handle, file);
event_system::instance().raise<debug_log>(
std::string{function_name}, api_path, std::to_string(handle));
if (error == api_error::success) {
api_meta_map meta;
error = provider_.get_item_meta(api_path, meta);
@@ -905,7 +899,6 @@ auto winfsp_drive::ReadDirectory(PVOID /*file_node*/, PVOID file_desc,
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
event_system::instance().raise<debug_log>(std::string{function_name}, "", "");
std::string api_path;
auto error = api_error::invalid_handle;

View File

@@ -78,10 +78,7 @@ auto encrypt_provider::create_api_file(
#if defined(_WIN32)
struct _stat64 buf {};
auto res = _stat64(source_path.c_str(), &buf);
event_system::instance().raise<debug_log>(
std::string{function_name}, source_path,
std::to_string(res) + ':' + std::to_string(directory));
_stat64(source_path.c_str(), &buf);
#else
struct stat buf {};
stat(source_path.c_str(), &buf);
@@ -137,15 +134,9 @@ auto encrypt_provider::create_api_file(
void encrypt_provider::create_item_meta(api_meta_map &meta, bool directory,
const api_file &file) {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
#if defined(_WIN32)
struct _stat64 buf {};
auto res = _stat64(file.source_path.c_str(), &buf);
event_system::instance().raise<debug_log>(
std::string{function_name}, file.source_path, std::to_string(res));
_stat64(file.source_path.c_str(), &buf);
#else
struct stat buf {};
stat(file.source_path.c_str(), &buf);
@@ -153,12 +144,21 @@ void encrypt_provider::create_item_meta(api_meta_map &meta, bool directory,
meta[META_ACCESSED] = std::to_string(file.accessed_date);
#if defined(_WIN32)
meta[META_ATTRIBUTES] =
std::to_string(::GetFileAttributesA(file.source_path.c_str()));
#endif
meta[META_ATTRIBUTES] = std::to_string(
::GetFileAttributesA(file.source_path.c_str()) &
~(FILE_ATTRIBUTE_REPARSE_POINT | FILE_ATTRIBUTE_COMPRESSED |
FILE_ATTRIBUTE_DEVICE | FILE_ATTRIBUTE_TEMPORARY |
FILE_ATTRIBUTE_SPARSE_FILE | FILE_ATTRIBUTE_OFFLINE |
FILE_ATTRIBUTE_NOT_CONTENT_INDEXED | FILE_ATTRIBUTE_ENCRYPTED |
FILE_ATTRIBUTE_INTEGRITY_STREAM | FILE_ATTRIBUTE_VIRTUAL |
FILE_ATTRIBUTE_NO_SCRUB_DATA | FILE_ATTRIBUTE_EA |
FILE_ATTRIBUTE_PINNED | FILE_ATTRIBUTE_UNPINNED |
FILE_ATTRIBUTE_RECALL_ON_OPEN | FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS));
#endif // defined(_WIN32)
#if defined(__APPLE__)
meta[META_BACKUP];
#endif
#endif // defined(__APPLE__)
meta[META_CHANGED] = std::to_string(file.changed_date);
meta[META_CREATION] = std::to_string(file.creation_date);
meta[META_DIRECTORY] = utils::string::from_bool(directory);
@@ -167,7 +167,7 @@ void encrypt_provider::create_item_meta(api_meta_map &meta, bool directory,
meta[META_MODIFIED] = std::to_string(file.modified_date);
#if defined(__APPLE__)
meta[META_OSXFLAGS];
#endif
#endif // defined(__APPLE__)
meta[META_SIZE] = std::to_string(file.file_size);
meta[META_SOURCE] = file.source_path;
meta[META_UID] = std::to_string(buf.st_uid);
@@ -448,13 +448,9 @@ auto encrypt_provider::get_file_list(api_file_list &list) const -> api_error {
};
const auto cfg = config_.get_encrypt_config();
event_system::instance().raise<debug_log>(std::string{function_name},
cfg.path, "");
try {
for (auto &&dir_entry : utils::file::directory{cfg.path}.get_items()) {
event_system::instance().raise<debug_log>(
std::string{function_name}, cfg.path, dir_entry->get_path());
std::string api_path{};
if (process_directory_entry(*dir_entry.get(), cfg, api_path)) {
list.emplace_back(create_api_file(
@@ -503,10 +499,6 @@ auto encrypt_provider::get_file_size(
auto encrypt_provider::get_filesystem_item(
const std::string &api_path, bool directory,
filesystem_item &fsi) const -> api_error {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto result = db::db_select{*db_, source_table}
.column("source_path")
.where("api_path")
@@ -519,9 +511,6 @@ auto encrypt_provider::get_filesystem_item(
auto source_path = row->get_column("source_path").get_value<std::string>();
event_system::instance().raise<debug_log>(
std::string{function_name}, source_path, std::to_string(directory));
if (directory) {
result = db::db_select{*db_, directory_table}
.column("api_path")
@@ -612,10 +601,6 @@ auto encrypt_provider::get_pinned_files() const -> std::vector<std::string> {
auto encrypt_provider::get_item_meta(const std::string &api_path,
api_meta_map &meta) const -> api_error {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto result = db::db_select{*db_, source_table}
.column("source_path")
.where("api_path")
@@ -635,8 +620,6 @@ auto encrypt_provider::get_item_meta(const std::string &api_path,
}
auto file = create_api_file(api_path, exists, source_path);
event_system::instance().raise<debug_log>(
std::string{function_name}, api_path, exists ? "true" : "false");
create_item_meta(meta, exists, file);
return api_error::success;
}

View File

@@ -81,7 +81,7 @@ static void root_creation_test(const std::string &mount_point) {
TEST_HEADER(__FUNCTION__);
WIN32_FILE_ATTRIBUTE_DATA ad{};
EXPECT_TRUE(
::GetFileAttributesEx(&mount_point[0], GetFileExInfoStandard, &ad));
::GetFileAttributesEx(mount_point.c_str(), GetFileExInfoStandard, &ad));
EXPECT_EQ(FILE_ATTRIBUTE_DIRECTORY, ad.dwFileAttributes);
EXPECT_EQ(0, ad.nFileSizeHigh);
EXPECT_EQ(0, ad.nFileSizeLow);