b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | From f42cbe1a91a3a6f79d1eec594ce7c72aec79179b Mon Sep 17 00:00:00 2001 |
| 2 | From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= <thomas@t-8ch.de> |
| 3 | Date: Wed, 9 Nov 2022 05:08:22 +0100 |
| 4 | Subject: [PATCH] don't fail hard on EACCES when copying xattrs |
| 5 | |
| 6 | On btrfs the xattr "btrfs.compressed" requires privileges to set, |
| 7 | otherwise EACCES is returned. |
| 8 | When patch tries to do copy this attribute it receives the error and |
| 9 | aborts. |
| 10 | --- |
| 11 | src/util.c | 4 ++-- |
| 12 | 1 file changed, 2 insertions(+), 2 deletions(-) |
| 13 | |
| 14 | --- a/src/util.c |
| 15 | +++ b/src/util.c |
| 16 | @@ -182,7 +182,7 @@ copy_attr_error (struct error_context *c |
| 17 | int err = errno; |
| 18 | va_list ap; |
| 19 | |
| 20 | - if (err != ENOSYS && err != ENOTSUP && err != EPERM) |
| 21 | + if (err != ENOSYS && err != ENOTSUP && err != EPERM && err != EACCES) |
| 22 | { |
| 23 | /* use verror module to print error message */ |
| 24 | va_start (ap, fmt); |
| 25 | @@ -284,7 +284,7 @@ set_file_attributes (char const *to, enu |
| 26 | } |
| 27 | if (attr & FA_XATTRS) |
| 28 | if (copy_attr (from, to) != 0 |
| 29 | - && errno != ENOSYS && errno != ENOTSUP && errno != EPERM) |
| 30 | + && errno != ENOSYS && errno != ENOTSUP && errno != EPERM && errno != EACCES) |
| 31 | fatal_exit (0); |
| 32 | if (attr & FA_MODE) |
| 33 | { |