@@ -16,7 +16,7 @@ use std::os::unix::net::UnixListener;
1616use std:: path:: { Path , PathBuf , StripPrefixError } ;
1717use std:: { fmt, io} ;
1818#[ cfg( all( unix, not( target_os = "android" ) ) ) ]
19- use uucore:: fsxattr:: copy_xattrs;
19+ use uucore:: fsxattr:: { copy_xattrs, copy_xattrs_skip_selinux } ;
2020use uucore:: translate;
2121
2222use clap:: { Arg , ArgAction , ArgMatches , Command , builder:: ValueParser , value_parser} ;
@@ -1748,21 +1748,6 @@ fn copy_extended_attrs(source: &Path, dest: &Path, skip_selinux: bool) -> CopyRe
17481748 Ok ( ( ) )
17491749}
17501750
1751- /// Copy extended attributes but skip security.selinux
1752- #[ cfg( all( unix, not( target_os = "android" ) ) ) ]
1753- fn copy_xattrs_skip_selinux ( source : & Path , dest : & Path ) -> std:: io:: Result < ( ) > {
1754- for attr_name in xattr:: list ( source) ? {
1755- // Skip security.selinux when -Z is used to set default context
1756- if attr_name. to_string_lossy ( ) == "security.selinux" {
1757- continue ;
1758- }
1759- if let Some ( value) = xattr:: get ( source, & attr_name) ? {
1760- xattr:: set ( dest, & attr_name, & value) ?;
1761- }
1762- }
1763- Ok ( ( ) )
1764- }
1765-
17661751/// Copy the specified attributes from one path to another.
17671752/// If `skip_selinux_xattr` is true, the security.selinux xattr will not be copied
17681753/// (used when -Z is specified to set the default context instead).
0 commit comments