refactor
This commit is contained in:
@@ -1242,7 +1242,7 @@ auto fuse_drive::truncate_impl(std::string api_path, off_t size) -> api_error {
|
||||
return res;
|
||||
}
|
||||
|
||||
open_file_data ofd = O_RDWR;
|
||||
open_file_data ofd{O_RDWR};
|
||||
std::uint64_t handle{};
|
||||
std::shared_ptr<i_open_file> open_file;
|
||||
if ((res = fm_->open(api_path, false, ofd, handle, open_file)) !=
|
||||
@@ -1250,12 +1250,10 @@ auto fuse_drive::truncate_impl(std::string api_path, off_t size) -> api_error {
|
||||
return res;
|
||||
}
|
||||
|
||||
const auto cleanup = [this, &handle](const api_error &err) -> api_error {
|
||||
fm_->close(handle);
|
||||
return err;
|
||||
};
|
||||
res = open_file->resize(static_cast<std::uint64_t>(size));
|
||||
fm_->close(handle);
|
||||
|
||||
return cleanup(open_file->resize(static_cast<std::uint64_t>(size)));
|
||||
return res;
|
||||
}
|
||||
|
||||
auto fuse_drive::unlink_impl(std::string api_path) -> api_error {
|
||||
|
Reference in New Issue
Block a user