File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -818,14 +818,16 @@ pub fn copy(from: &Path, to: &Path) -> io::Result<u64> {
818
818
( metadata. permissions ( ) , metadata. size ( ) )
819
819
} ;
820
820
821
+ let has_copy_file_range = HAS_COPY_FILE_RANGE . load ( Ordering :: Relaxed ) ;
821
822
let mut written = 0u64 ;
822
823
while written < len {
824
+ // TODO should ideally use TryFrom
823
825
let bytes_to_copy = if len - written > usize:: max_value ( ) as u64 {
824
826
usize:: max_value ( )
825
827
} else {
826
828
( len - written) as usize
827
829
} ;
828
- let copy_result = if HAS_COPY_FILE_RANGE . load ( Ordering :: Relaxed ) {
830
+ let copy_result = if has_copy_file_range {
829
831
let copy_result = unsafe {
830
832
// We actually don't have to adjust the offsets,
831
833
// because copy_file_range adjusts the file offset automatically
You can’t perform that action at this time.
0 commit comments