@@ -264,55 +264,40 @@ fn copy_direntry(
264264
265265 // If the source is not a directory, then we need to copy the file.
266266 if !source_absolute. is_dir ( ) {
267- if preserve_hard_links {
268- match copy_file (
269- progress_bar,
270- & source_absolute,
271- local_to_target. as_path ( ) ,
272- options,
273- symlinked_files,
274- copied_destinations,
275- copied_files,
276- false ,
277- ) {
278- Ok ( _) => Ok ( ( ) ) ,
279- Err ( err) => {
280- if source_absolute. is_symlink ( ) {
281- // silent the error with a symlink
282- // In case we do --archive, we might copy the symlink
283- // before the file itself
284- Ok ( ( ) )
285- } else {
286- Err ( err)
287- }
267+ if let Err ( err) = copy_file (
268+ progress_bar,
269+ & source_absolute,
270+ local_to_target. as_path ( ) ,
271+ options,
272+ symlinked_files,
273+ copied_destinations,
274+ copied_files,
275+ false ,
276+ ) {
277+ if preserve_hard_links {
278+ if !source_absolute. is_symlink ( ) {
279+ return Err ( err) ;
288280 }
289- } ?;
290- } else {
291- // At this point, `path` is just a plain old file.
292- // Terminate this function immediately if there is any
293- // kind of error *except* a "permission denied" error.
294- //
295- // TODO What other kinds of errors, if any, should
296- // cause us to continue walking the directory?
297- match copy_file (
298- progress_bar,
299- & source_absolute,
300- local_to_target. as_path ( ) ,
301- options,
302- symlinked_files,
303- copied_destinations,
304- copied_files,
305- false ,
306- ) {
307- Ok ( _) => { }
308- Err ( Error :: IoErrContext ( e, _) ) if e. kind ( ) == io:: ErrorKind :: PermissionDenied => {
309- show ! ( uio_error!(
310- e,
311- "cannot open {} for reading" ,
312- source_relative. quote( ) ,
313- ) ) ;
281+ // silent the error with a symlink
282+ // In case we do --archive, we might copy the symlink
283+ // before the file itself
284+ } else {
285+ // At this point, `path` is just a plain old file.
286+ // Terminate this function immediately if there is any
287+ // kind of error *except* a "permission denied" error.
288+ //
289+ // TODO What other kinds of errors, if any, should
290+ // cause us to continue walking the directory?
291+ match err {
292+ Error :: IoErrContext ( e, _) if e. kind ( ) == io:: ErrorKind :: PermissionDenied => {
293+ show ! ( uio_error!(
294+ e,
295+ "cannot open {} for reading" ,
296+ source_relative. quote( ) ,
297+ ) ) ;
298+ }
299+ e => return Err ( e) ,
314300 }
315- Err ( e) => return Err ( e) ,
316301 }
317302 }
318303 }
0 commit comments