| 2825 | /* Set *X to the default options for a value of type struct cp_options. */ |
| 2826 | |
| 2827 | extern void |
| 2828 | cp_options_default (struct cp_options *x) |
| 2829 | { |
| 2830 | memset (x, 0, sizeof *x); |
| 2831 | #ifdef PRIV_FILE_CHOWN |
| 2832 | { |
| 2833 | priv_set_t *pset = priv_allocset (); |
| 2834 | if (!pset) |
| 2835 | xalloc_die (); |
| 2836 | if (getppriv (PRIV_EFFECTIVE, pset) == 0) |
| 2837 | { |
| 2838 | x->chown_privileges = priv_ismember (pset, PRIV_FILE_CHOWN); |
| 2839 | x->owner_privileges = priv_ismember (pset, PRIV_FILE_OWNER); |
| 2840 | } |
| 2841 | priv_freeset (pset); |
| 2842 | } |
| 2843 | #else |
| 2844 | x->chown_privileges = x->owner_privileges = (geteuid () == ROOT_UID); |
| 2845 | #endif |
| 2846 | x->rename_errno = -1; |
| 2847 | } |
| 2848 | |
| 2849 | /* Return true if it's OK for chown to fail, where errno is |
| 2850 | the error number that chown failed with and X is the copying |
no test coverage detected