| 635 | Return false on failure, true on success. */ |
| 636 | |
| 637 | bool |
| 638 | set_file_security_ctx (char const *dst_name, |
| 639 | bool recurse, const struct cp_options *x) |
| 640 | { |
| 641 | bool all_errors = (!x->data_copy_required |
| 642 | || x->require_preserve_context); |
| 643 | bool some_errors = !all_errors && !x->reduce_diagnostics; |
| 644 | |
| 645 | if (! restorecon (x->set_security_context, dst_name, recurse)) |
| 646 | { |
| 647 | if (all_errors || (some_errors && !errno_unsupported (errno))) |
| 648 | error (0, errno, _("failed to set the security context of %s"), |
| 649 | quoteaf_n (0, dst_name)); |
| 650 | return false; |
| 651 | } |
| 652 | |
| 653 | return true; |
| 654 | } |
| 655 | |
| 656 | #if HAVE_FCLONEFILEAT && !USE_XATTR |
| 657 | # include <sys/acl.h> |
no test coverage detected