fix macos deadlock
This commit is contained in:
@@ -398,24 +398,27 @@ auto remote_fuse_drive::readdir_impl(std::string api_path, void *buf,
|
|||||||
api_path.c_str(), static_cast<remote::file_offset>(offset),
|
api_path.c_str(), static_cast<remote::file_offset>(offset),
|
||||||
f_info->fh, item_path)) == 0) {
|
f_info->fh, item_path)) == 0) {
|
||||||
std::unique_ptr<struct stat> p_stat{nullptr};
|
std::unique_ptr<struct stat> p_stat{nullptr};
|
||||||
int stat_res{0};
|
|
||||||
if ((item_path == ".") || (item_path == "..")) {
|
if ((item_path == ".") || (item_path == "..")) {
|
||||||
|
auto stat_res{api_error::success};
|
||||||
p_stat = std::make_unique<struct stat>();
|
p_stat = std::make_unique<struct stat>();
|
||||||
std::memset(p_stat.get(), 0, sizeof(struct stat));
|
std::memset(p_stat.get(), 0, sizeof(struct stat));
|
||||||
if (item_path == ".") {
|
if (item_path == ".") {
|
||||||
stat_res =
|
stat_res = getattr_impl(api_path, p_stat.get());
|
||||||
stat(utils::path::combine(get_mount_location(), {api_path}).c_str(),
|
} else if (api_path == "/" && get_mount_location() != "/") {
|
||||||
|
auto local_res =
|
||||||
|
stat(utils::path::get_parent_path(get_mount_location()).c_str(),
|
||||||
p_stat.get());
|
p_stat.get());
|
||||||
|
if (local_res != 0) {
|
||||||
|
res = local_res;
|
||||||
|
break;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
stat_res =
|
stat_res = getattr_impl(utils::path::get_parent_api_path(api_path),
|
||||||
stat(utils::path::get_parent_path(
|
p_stat.get());
|
||||||
utils::path::combine(get_mount_location(), {api_path}))
|
|
||||||
.c_str(),
|
|
||||||
p_stat.get());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stat_res != 0) {
|
if (stat_res != api_error::success) {
|
||||||
res = stat_res;
|
res = utils::from_api_error(stat_res);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user