diff --git a/repertory/librepertory/src/drives/fuse/remotefuse/remote_fuse_drive.cpp b/repertory/librepertory/src/drives/fuse/remotefuse/remote_fuse_drive.cpp index 5d2245a8..f2256f3e 100644 --- a/repertory/librepertory/src/drives/fuse/remotefuse/remote_fuse_drive.cpp +++ b/repertory/librepertory/src/drives/fuse/remotefuse/remote_fuse_drive.cpp @@ -397,28 +397,34 @@ auto remote_fuse_drive::readdir_impl(std::string api_path, void *buf, while ((res = remote_instance_->fuse_readdir( api_path.c_str(), static_cast(offset), f_info->fh, item_path)) == 0) { - std::unique_ptr p_stat; + auto stat_res{0}; + std::unique_ptr p_stat{nullptr}; if ((item_path == ".") || (item_path == "..")) { p_stat = std::make_unique(); + std::memset(p_stat.get(), 0, sizeof(struct stat)); if (item_path == ".") { - res = stat(get_mount_location().c_str(), p_stat.get()); + stat_res = stat(get_mount_location().c_str(), p_stat.get()); } else { - res = stat(utils::path::get_parent_path(get_mount_location()).c_str(), - p_stat.get()); + stat_res = + stat(utils::path::get_parent_path(get_mount_location()).c_str(), + p_stat.get()); } } else { item_path = utils::path::strip_to_file_name(item_path); } - if (res == 0) { + if (stat_res != 0) { + res = stat_res; + break; + } + #if FUSE_USE_VERSION >= 30 - if (fuse_fill_dir(buf, item_path.c_str(), p_stat.get(), ++offset, - FUSE_FILL_DIR_PLUS) != 0) { + if (fuse_fill_dir(buf, item_path.c_str(), p_stat.get(), ++offset, + FUSE_FILL_DIR_PLUS) != 0) { #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 - break; - } + break; } if (res == -120) {