* src/ls.c (file_aclinfo_cache): Also optimize selinux ENOTSUP caching
when we don't care about ACLs.
---
 src/ls.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/ls.c b/src/ls.c
index 8e6706647..bf9644a92 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -3255,10 +3255,14 @@ file_has_aclinfo_cache (char const *file, struct 
fileinfo *f,
   errno = 0;
   int n = file_has_aclinfo (file, ai, flags);
   int err = errno;
+  if (!USE_ACL)
+    n = 0;
   /* A security-context error does not imply that ACLs are unsupported.
-     Require an unsupported attribute listing too.  */
+     Require an unsupported attribute listing too if ACLs or capability
+     colors are needed.  */
   if (f->stat_ok && n <= 0 && !acl_errno_valid (err)
-      && ai->size < 0 && !acl_errno_valid (ai->u.err)
+      && ((!USE_ACL && !format_needs_capability)
+          || (ai->size < 0 && !acl_errno_valid (ai->u.err)))
       && (!(flags & ACL_GET_SCONTEXT) || !acl_errno_valid (ai->scontext_err)))
     {
       unsupported_return = n;
-- 
2.55.0


Reply via email to