fix . and .. incorrectly being reported as files
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good

This commit is contained in:
2025-07-26 11:04:59 -05:00
parent c74a70ce13
commit 4508b6d908

View File

@@ -401,29 +401,29 @@ auto remote_fuse_drive::readdir_impl(std::string api_path, void *buf,
if ((item_path == ".") || (item_path == "..")) { if ((item_path == ".") || (item_path == "..")) {
p_stat = std::make_unique<struct stat>(); p_stat = std::make_unique<struct stat>();
if (item_path == ".") { if (item_path == ".") {
stat(get_mount_location().c_str(), p_stat.get()); res = stat(get_mount_location().c_str(), p_stat.get());
} else { } else {
stat(utils::path::get_parent_path(get_mount_location()).c_str(), res = stat(utils::path::get_parent_path(get_mount_location()).c_str(),
p_stat.get()); p_stat.get());
} }
// p_stat->st_mode = S_IFDIR | 0755;
// p_stat->st_nlink = 2;
} else { } else {
item_path = utils::path::strip_to_file_name(item_path); item_path = utils::path::strip_to_file_name(item_path);
} }
if (res == 0) {
#if FUSE_USE_VERSION >= 30 #if FUSE_USE_VERSION >= 30
if (fuse_fill_dir(buf, item_path.c_str(), p_stat.get(), ++offset, if (fuse_fill_dir(buf, item_path.c_str(), p_stat.get(), ++offset,
FUSE_FILL_DIR_PLUS) != 0) { FUSE_FILL_DIR_PLUS) != 0) {
#else // FUSE_USE_VERSION < 30 #else // FUSE_USE_VERSION < 30
if (fuse_fill_dir(buf, item_path.c_str(), p_stat.get(), ++offset) != 0) { if (fuse_fill_dir(buf, item_path.c_str(), p_stat.get(), ++offset) != 0) {
#endif // FUSE_USE_VERSION >= 30 #endif // FUSE_USE_VERSION >= 30
break; break;
}
} }
}
if (res == -120) { if (res == -120) {
res = 0; res = 0;
}
} }
return utils::to_api_error(res); return utils::to_api_error(res);