mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
On MacOS, writing more than 0x7fffffff bytes will fail with errno 22 (#737)
This commit is contained in:
parent
afb630bf41
commit
50d2361394
1 changed files with 2 additions and 3 deletions
|
@ -82,10 +82,9 @@ class WriteFile : public td::actor::Actor {
|
|||
: tmp_dir_(tmp_dir), new_name_(new_name), promise_(std::move(promise)) {
|
||||
write_data_ = [data_ptr = std::make_shared<td::BufferSlice>(std::move(data))] (td::FileFd& fd) {
|
||||
auto data = std::move(*data_ptr);
|
||||
td::uint64 offset = 0;
|
||||
while (data.size() > 0) {
|
||||
TRY_RESULT(s, fd.pwrite(data.as_slice(), offset));
|
||||
offset += s;
|
||||
auto piece_size = std::min<size_t>(data.size(), 1 << 30);
|
||||
TRY_RESULT(s, fd.write(data.as_slice().substr(0, piece_size)));
|
||||
data.confirm_read(s);
|
||||
}
|
||||
return td::Status::OK();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue