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