070-don-t-fail-hard-on-EACCES-when-copying-xattrs.patch 1.1 KB

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