fix
This commit is contained in:
parent
468aba1399
commit
7cb78cab40
@ -1099,9 +1099,8 @@ auto winfsp_drive::SetFileSize(PVOID /*file_node*/, PVOID file_desc,
|
|||||||
std::shared_ptr<i_open_file> file;
|
std::shared_ptr<i_open_file> file;
|
||||||
if (fm_->get_open_file(handle, true, file)) {
|
if (fm_->get_open_file(handle, true, file)) {
|
||||||
api_path = file->get_api_path();
|
api_path = file->get_api_path();
|
||||||
i_open_file::native_operation_callback allocator;
|
|
||||||
if (set_allocation_size != 0U) {
|
if (set_allocation_size != 0U) {
|
||||||
allocator = [&](native_handle cur_handle) -> api_error {
|
const auto allocator = [&](native_handle cur_handle) -> api_error {
|
||||||
std::string meta_allocation_size;
|
std::string meta_allocation_size;
|
||||||
utils::calculate_allocation_size(false, 0, new_size,
|
utils::calculate_allocation_size(false, 0, new_size,
|
||||||
meta_allocation_size);
|
meta_allocation_size);
|
||||||
@ -1116,9 +1115,9 @@ auto winfsp_drive::SetFileSize(PVOID /*file_node*/, PVOID file_desc,
|
|||||||
: api_error::os_error;
|
: api_error::os_error;
|
||||||
};
|
};
|
||||||
|
|
||||||
new_size = file->get_file_size();
|
error = file->native_operation(allocator);
|
||||||
} else {
|
} else {
|
||||||
allocator = [&](native_handle cur_handle) -> api_error {
|
const auto allocator = [&](native_handle cur_handle) -> api_error {
|
||||||
FILE_END_OF_FILE_INFO end_of_file_info{};
|
FILE_END_OF_FILE_INFO end_of_file_info{};
|
||||||
end_of_file_info.EndOfFile.QuadPart = static_cast<LONGLONG>(new_size);
|
end_of_file_info.EndOfFile.QuadPart = static_cast<LONGLONG>(new_size);
|
||||||
return ::SetFileInformationByHandle(cur_handle, FileEndOfFileInfo,
|
return ::SetFileInformationByHandle(cur_handle, FileEndOfFileInfo,
|
||||||
@ -1127,9 +1126,9 @@ auto winfsp_drive::SetFileSize(PVOID /*file_node*/, PVOID file_desc,
|
|||||||
? api_error::success
|
? api_error::success
|
||||||
: api_error::os_error;
|
: api_error::os_error;
|
||||||
};
|
};
|
||||||
|
error = file->native_operation(new_size, allocator);
|
||||||
}
|
}
|
||||||
|
|
||||||
error = file->native_operation(new_size, allocator);
|
|
||||||
if (file_info != nullptr) {
|
if (file_info != nullptr) {
|
||||||
// Populate file information
|
// Populate file information
|
||||||
api_meta_map meta;
|
api_meta_map meta;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user