@@ -1492,7 +1492,7 @@ fn copy_source(
14921492 if options. parents {
14931493 for ( x, y) in aligned_ancestors ( source, dest. as_path ( ) ) {
14941494 if let Ok ( src) = canonicalize ( x, MissingHandling :: Normal , ResolveMode :: Physical ) {
1495- copy_attributes ( & src, y, & options. attributes , options ) ?;
1495+ copy_attributes ( & src, y, & options. attributes ) ?;
14961496 }
14971497 }
14981498 }
@@ -1640,12 +1640,10 @@ fn copy_extended_attrs(source: &Path, dest: &Path) -> CopyResult<()> {
16401640}
16411641
16421642/// Copy the specified attributes from one path to another.
1643- #[ allow( unused_variables) ]
16441643pub ( crate ) fn copy_attributes (
16451644 source : & Path ,
16461645 dest : & Path ,
16471646 attributes : & Attributes ,
1648- options : & Options ,
16491647) -> CopyResult < ( ) > {
16501648 let context = & * format ! ( "{} -> {}" , source. quote( ) , dest. quote( ) ) ;
16511649 let source_metadata = fs:: symlink_metadata ( source) . context ( context) ?;
@@ -2442,23 +2440,26 @@ fn copy_file(
24422440 if options. dereference ( source_in_command_line) {
24432441 if let Ok ( src) = canonicalize ( source, MissingHandling :: Normal , ResolveMode :: Physical ) {
24442442 if src. exists ( ) {
2445- copy_attributes ( & src, dest, & options. attributes , options ) ?;
2443+ copy_attributes ( & src, dest, & options. attributes ) ?;
24462444 }
24472445 }
24482446 } else if source_is_stream && source. exists ( ) {
24492447 // Some stream files may not exist after we have copied it,
24502448 // like anonymous pipes. Thus, we can't really copy its
24512449 // attributes. However, this is already handled in the stream
24522450 // copy function (see `copy_stream` under platform/linux.rs).
2453- copy_attributes ( source, dest, & options. attributes , options) ?;
24542451 } else {
2455- copy_attributes ( source, dest, & options. attributes , options ) ?;
2452+ copy_attributes ( source, dest, & options. attributes ) ?;
24562453 }
24572454
24582455 #[ cfg( feature = "selinux" ) ]
24592456 if options. set_selinux_context && uucore:: selinux:: is_selinux_enabled ( ) {
24602457 // Set the given selinux permissions on the copied file.
2461- uucore:: selinux:: set_selinux_security_context ( dest, options. context . as_ref ( ) ) ?;
2458+ if let Err ( e) =
2459+ uucore:: selinux:: set_selinux_security_context ( dest, options. context . as_ref ( ) )
2460+ {
2461+ return Err ( Error :: Error ( format ! ( "SELinux error: {}" , e) ) ) ;
2462+ }
24622463 }
24632464
24642465 copied_files. insert (
0 commit comments