Skip to content

Commit 3eae759

Browse files
committed
set_selinux_security_context: also display the error from the crate
+ fix comments from review
1 parent 4325fd1 commit 3eae759

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/uu/cp/src/cp.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2458,7 +2458,11 @@ fn copy_file(
24582458
#[cfg(feature = "selinux")]
24592459
if options.set_selinux_context && uucore::selinux::is_selinux_enabled() {
24602460
// Set the given selinux permissions on the copied file.
2461-
uucore::selinux::set_selinux_security_context(dest, options.context.as_ref())?;
2461+
if let Err(e) =
2462+
uucore::selinux::set_selinux_security_context(dest, options.context.as_ref())
2463+
{
2464+
return Err(Error::Error(format!("SELinux error: {}", e)));
2465+
}
24622466
}
24632467

24642468
copied_files.insert(

0 commit comments

Comments
 (0)