]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
ls: use Gnulib’s unsupported errno list
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 7 Nov 2024 16:57:42 +0000 (08:57 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 9 Nov 2024 07:41:18 +0000 (23:41 -0800)
* bootstrap.conf (gnulib_modules): Add acl-permissions, which
supplies acl_errno_valid, and which we are already using
indirectly via file-has-acl.
* src/ls.c (errno_unsupported): Remove.  All calls replaced
by !acl_errno_valid.

bootstrap.conf
src/ls.c

index be9b8b7fdc8a75ad533a8c8b10ef69b41302989d..480e029310a9b5a4311611bd4b513f9e124d83c7 100644 (file)
@@ -28,6 +28,7 @@ avoided_gnulib_modules='
 gnulib_modules="
   $avoided_gnulib_modules
   acl
+  acl-permissions
   alignalloc
   alignasof
   alloca
index 290ce35d24b0c091ee94abaf8bcd86b72550a1c7..962737432d951e176e176e8eb36c9efb0f30c2f3 100644 (file)
--- a/src/ls.c
+++ b/src/ls.c
@@ -3277,14 +3277,6 @@ clear_files (void)
   file_size_width = 0;
 }
 
-/* Return true if ERR implies lack-of-support failure by a
-   getxattr-calling function like file_has_acl.  */
-static bool
-errno_unsupported (int err)
-{
-  return (err == EINVAL || err == ENOSYS || is_ENOTSUP (err));
-}
-
 /* Cache file_has_aclinfo failure, when it's trivial to do.
    Like file_has_aclinfo, but when F's st_dev says it's on a file
    system lacking ACL support, return 0 with ENOTSUP immediately.  */
@@ -3303,7 +3295,7 @@ file_has_aclinfo_cache (char const *file, struct fileinfo *f,
     }
 
   int n = file_has_aclinfo (file, ai, flags);
-  if (n <= 0 && errno_unsupported (ai->u.err))
+  if (n <= 0 && !acl_errno_valid (ai->u.err))
     unsupported_device = f->stat.st_dev;
   return n;
 }
@@ -3325,7 +3317,7 @@ has_capability_cache (char const *file, struct fileinfo *f)
     }
 
   bool b = has_capability (file);
-  if ( !b && errno_unsupported (errno))
+  if ( !b && !acl_errno_valid (errno))
     unsupported_device = f->stat.st_dev;
   return b;
 }