Compare commits

...

2 Commits

Author SHA1 Message Date
2afa403c8c [bug] Windows-to-Linux remote mount is allowing directory rename when directory is not empty #47
Some checks reported errors
BlockStorage/repertory/pipeline/head Something is wrong with the build of this commit
2025-04-16 14:19:39 -05:00
d09210d9c4 [bug] Windows-to-Linux remote mount is allowing directory rename when directory is not empty #47 2025-04-16 13:31:57 -05:00
2 changed files with 15 additions and 16 deletions

View File

@ -39,33 +39,31 @@ auto directory_iterator::fill_buffer(const remote::file_offset &offset,
}
try {
std::string item_name;
struct stat st{};
struct stat *pst = nullptr;
switch (offset) {
case 0: {
item_name = ".";
} break;
auto next_offset{offset + 1U};
std::string item_name;
struct stat u_stat{};
switch (offset) {
case 0:
case 1: {
item_name = "..";
item_name = offset == 0U ? "." : "..";
u_stat.st_mode = S_IFDIR | 0755;
u_stat.st_nlink = 2;
} break;
default: {
const auto &item = items_[offset];
item_name = utils::path::strip_to_file_name(item.api_path);
populate_stat(item.api_path, item.size, item.meta, item.directory, &st);
pst = &st;
item_name = utils::path::strip_to_file_name(items_.at(offset).api_path);
} break;
}
#if FUSE_USE_VERSION >= 30
if (filler_function(buffer, item_name.data(), pst,
static_cast<off_t>(offset + 1),
if (filler_function(buffer, item_name.data(), &u_stat,
static_cast<off_t>(next_offset),
FUSE_FILL_DIR_PLUS) != 0)
#else // FUSE_USE_VERSION < 30
if (filler_function(buffer, item_name.data(), pst,
static_cast<off_t>(offset + 1)) != 0)
if (filler_function(buffer, item_name.data(), &u_stat,
static_cast<off_t>(next_offset)) != 0)
#endif // FUSE_USE_VERSION >= 30
{
errno = ENOMEM;

View File

@ -1790,4 +1790,5 @@ auto remote_server::update_to_windows_format(const std::string &root_api_path,
return item;
}
} // namespace repertory::remote_fuse
#endif // _WIN32