We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b605923 commit f4c2825Copy full SHA for f4c2825
src/libstd/sys/unix/fs.rs
@@ -815,14 +815,15 @@ pub fn copy(from: &Path, to: &Path) -> io::Result<u64> {
815
816
let mut written = 0u64;
817
while written < len {
818
+ let bytes_to_copy = len - written;
819
let copy_result = unsafe {
820
// We actually don't have to adjust the offsets,
821
// because copy_file_range adjusts the file offset automatically
822
cvt(copy_file_range(reader.as_raw_fd(),
823
ptr::null_mut(),
824
writer.as_raw_fd(),
825
- len as usize,
826
+ bytes_to_copy as usize,
827
0)
828
)
829
};
0 commit comments