mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-17 05:25:37 +03:00
Adjust len in every iteration
This commit is contained in:
@@ -815,6 +815,7 @@ unsafe fn copy_file_range(
|
||||
|
||||
let mut written = 0u64;
|
||||
while written < len {
|
||||
let bytes_to_copy = len - written;
|
||||
let copy_result = unsafe {
|
||||
// We actually don't have to adjust the offsets,
|
||||
// because copy_file_range adjusts the file offset automatically
|
||||
@@ -822,7 +823,7 @@ unsafe fn copy_file_range(
|
||||
ptr::null_mut(),
|
||||
writer.as_raw_fd(),
|
||||
ptr::null_mut(),
|
||||
len as usize,
|
||||
bytes_to_copy as usize,
|
||||
0)
|
||||
)
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user