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 45de3fa5..a47c28ed 100644 --- a/repertory/librepertory/src/drives/fuse/remotefuse/remote_fuse_drive.cpp +++ b/repertory/librepertory/src/drives/fuse/remotefuse/remote_fuse_drive.cpp @@ -398,24 +398,27 @@ auto remote_fuse_drive::readdir_impl(std::string api_path, void *buf, api_path.c_str(), static_cast(offset), f_info->fh, item_path)) == 0) { std::unique_ptr p_stat{nullptr}; - int stat_res{0}; if ((item_path == ".") || (item_path == "..")) { + auto stat_res{api_error::success}; p_stat = std::make_unique(); std::memset(p_stat.get(), 0, sizeof(struct stat)); if (item_path == ".") { - stat_res = - stat(utils::path::combine(get_mount_location(), {api_path}).c_str(), + stat_res = getattr_impl(api_path, p_stat.get()); + } else if (api_path == "/" && get_mount_location() != "/") { + auto local_res = + stat(utils::path::get_parent_path(get_mount_location()).c_str(), p_stat.get()); + if (local_res != 0) { + res = local_res; + break; + } } else { - stat_res = - stat(utils::path::get_parent_path( - utils::path::combine(get_mount_location(), {api_path})) - .c_str(), - p_stat.get()); + stat_res = getattr_impl(utils::path::get_parent_api_path(api_path), + p_stat.get()); } - if (stat_res != 0) { - res = stat_res; + if (stat_res != api_error::success) { + res = utils::from_api_error(stat_res); break; } } else {