fix truncate
All checks were successful
BlockStorage/repertory_osx_builds/pipeline/head This commit looks good
All checks were successful
BlockStorage/repertory_osx_builds/pipeline/head This commit looks good
This commit is contained in:
@@ -159,29 +159,32 @@ auto fuse_drive::create_impl(std::string api_path, mode_t mode,
|
||||
}
|
||||
|
||||
std::uint64_t handle{};
|
||||
std::shared_ptr<i_open_file> open_file;
|
||||
if (is_create_op) {
|
||||
const auto now = utils::get_file_time_now();
|
||||
{
|
||||
std::shared_ptr<i_open_file> open_file;
|
||||
if (is_create_op) {
|
||||
const auto now = utils::get_file_time_now();
|
||||
#ifdef __APPLE__
|
||||
const auto osx_flags = static_cast<std::uint32_t>(file_info->flags);
|
||||
const auto osx_flags = static_cast<std::uint32_t>(file_info->flags);
|
||||
#else
|
||||
const auto osx_flags = 0U;
|
||||
const auto osx_flags = 0U;
|
||||
#endif
|
||||
|
||||
auto meta = create_meta_attributes(
|
||||
now, FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_ARCHIVE, now, now,
|
||||
is_directory_op, get_effective_gid(), "", mode, now, 0U, osx_flags, 0U,
|
||||
utils::path::combine(config_.get_cache_directory(),
|
||||
{utils::create_uuid_string()}),
|
||||
get_effective_uid(), now);
|
||||
auto meta = create_meta_attributes(
|
||||
now, FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_ARCHIVE, now, now,
|
||||
is_directory_op, get_effective_gid(), "", mode, now, 0U, osx_flags,
|
||||
0U,
|
||||
utils::path::combine(config_.get_cache_directory(),
|
||||
{utils::create_uuid_string()}),
|
||||
get_effective_uid(), now);
|
||||
|
||||
res = fm_->create(api_path, meta, file_info->flags, handle, open_file);
|
||||
if ((res != api_error::item_exists) && (res != api_error::success)) {
|
||||
res = fm_->create(api_path, meta, file_info->flags, handle, open_file);
|
||||
if ((res != api_error::item_exists) && (res != api_error::success)) {
|
||||
return res;
|
||||
}
|
||||
} else if (((res = fm_->open(api_path, is_directory_op, file_info->flags,
|
||||
handle, open_file)) != api_error::success)) {
|
||||
return res;
|
||||
}
|
||||
} else if (((res = fm_->open(api_path, is_directory_op, file_info->flags,
|
||||
handle, open_file)) != api_error::success)) {
|
||||
return res;
|
||||
}
|
||||
|
||||
file_info->fh = handle;
|
||||
@@ -1242,17 +1245,18 @@ auto fuse_drive::truncate_impl(std::string api_path, off_t size) -> api_error {
|
||||
return res;
|
||||
}
|
||||
|
||||
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)) !=
|
||||
api_error::success) {
|
||||
return res;
|
||||
{
|
||||
open_file_data ofd{O_RDWR};
|
||||
std::shared_ptr<i_open_file> open_file;
|
||||
if ((res = fm_->open(api_path, false, ofd, handle, open_file)) !=
|
||||
api_error::success) {
|
||||
return res;
|
||||
}
|
||||
|
||||
res = open_file->resize(static_cast<std::uint64_t>(size));
|
||||
}
|
||||
|
||||
res = open_file->resize(static_cast<std::uint64_t>(size));
|
||||
fm_->close(handle);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user