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> {
818818 ( metadata. permissions ( ) , metadata. size ( ) )
819819 } ;
820820
821+ let has_copy_file_range = HAS_COPY_FILE_RANGE . load ( Ordering :: Relaxed ) ;
821822 let mut written = 0u64 ;
822823 while written < len {
824+ // TODO should ideally use TryFrom
823825 let bytes_to_copy = if len - written > usize:: max_value ( ) as u64 {
824826 usize:: max_value ( )
825827 } else {
826828 ( len - written) as usize
827829 } ;
828- let copy_result = if HAS_COPY_FILE_RANGE . load ( Ordering :: Relaxed ) {
830+ let copy_result = if has_copy_file_range {
829831 let copy_result = unsafe {
830832 // We actually don't have to adjust the offsets,
831833 // because copy_file_range adjusts the file offset automatically
You can’t perform that action at this time.
0 commit comments