This commit is contained in:
2025-01-22 08:05:35 -06:00
parent 5da4d4e940
commit 124dc62250

View File

@ -33,7 +33,11 @@ auto directory_iterator::fill_buffer(const remote::file_offset &offset,
-> int {
REPERTORY_USES_FUNCTION_NAME();
if (offset < items_.size()) {
if (offset >= items_.size()) {
errno = 120;
return -1;
}
try {
std::string item_name;
struct stat st{};
@ -58,11 +62,12 @@ auto directory_iterator::fill_buffer(const remote::file_offset &offset,
#if FUSE_USE_VERSION >= 30
if (filler_function(buffer, item_name.data(), pst,
static_cast<off_t>(offset + 1),
FUSE_FILL_DIR_PLUS) != 0) {
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) {
static_cast<off_t>(offset + 1)) != 0)
#endif // FUSE_USE_VERSION >= 30
{
errno = ENOMEM;
return -1;
}
@ -73,10 +78,6 @@ auto directory_iterator::fill_buffer(const remote::file_offset &offset,
return 0;
}
errno = 120;
return -1;
}
#endif // !defined(_WIN32)
auto directory_iterator::get(std::size_t offset, std::string &item) -> int {