| 2851 | option set. */ |
| 2852 | |
| 2853 | extern bool |
| 2854 | chown_failure_ok (struct cp_options const *x) |
| 2855 | { |
| 2856 | /* If non-root uses -p, it's ok if we can't preserve ownership. |
| 2857 | But root probably wants to know, e.g. if NFS disallows it, |
| 2858 | or if the target system doesn't support file ownership. |
| 2859 | |
| 2860 | Treat EACCES like EPERM and EINVAL to work around a bug in Linux |
| 2861 | CIFS <https://bugs.gnu.org/65599>. Although this means coreutils |
| 2862 | will ignore EACCES errors that it should report, problems should |
| 2863 | occur only when some other process is racing with coreutils and |
| 2864 | coreutils is not immune to races anyway. */ |
| 2865 | |
| 2866 | return ((errno == EPERM || errno == EINVAL || errno == EACCES) |
| 2867 | && !x->chown_privileges); |
| 2868 | } |
| 2869 | |
| 2870 | /* Similarly, return true if it's OK for chmod and similar operations |
| 2871 | to fail, where errno is the error number that chmod failed with and |
no outgoing calls
no test coverage detected