]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
ls: support capabilities with device 0,0
authorPádraig Brady <P@draigBrady.com>
Tue, 8 Apr 2025 11:11:06 +0000 (12:11 +0100)
committerPádraig Brady <P@draigBrady.com>
Tue, 8 Apr 2025 11:17:19 +0000 (12:17 +0100)
* src/ls.c (has_capability_cache): Don't assume
a device major,minor of 0,0 never occurs.

src/ls.c

index de5a1ae2b901986677c4328527a5b1a814b3af42..1078f882f026ed20194766eb602365d9b90754bd 100644 (file)
--- a/src/ls.c
+++ b/src/ls.c
@@ -3348,9 +3348,10 @@ has_capability_cache (char const *file, struct fileinfo *f)
 {
   /* st_dev of the most recently processed device for which we've
      found that has_capability fails indicating lack of support.  */
+  static bool unsupported_cached /* = false */;
   static dev_t unsupported_device;
 
-  if (f->stat_ok && f->stat.st_dev == unsupported_device)
+  if (f->stat_ok && unsupported_cached && f->stat.st_dev == unsupported_device)
     {
       errno = ENOTSUP;
       return 0;
@@ -3358,7 +3359,10 @@ has_capability_cache (char const *file, struct fileinfo *f)
 
   bool b = has_capability (file);
   if (f->stat_ok && !b && !acl_errno_valid (errno))
-    unsupported_device = f->stat.st_dev;
+    {
+      unsupported_cached = true;
+      unsupported_device = f->stat.st_dev;
+    }
   return b;
 }