From 7007c018de51f972c89f153c128a7a9ce08ac432 Mon Sep 17 00:00:00 2001 From: =?utf8?q?P=C3=A1draig=20Brady?= Date: Tue, 8 Apr 2025 12:11:06 +0100 Subject: [PATCH] ls: support capabilities with device 0,0 * src/ls.c (has_capability_cache): Don't assume a device major,minor of 0,0 never occurs. --- src/ls.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ls.c b/src/ls.c index de5a1ae2b9..1078f882f0 100644 --- 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; } -- 2.47.3