Cache has_capability failure, when it's trivial to do. Like has_capability, but when F's st_dev says it's on a file system lacking capability support, return 0 with ENOTSUP immediately. */
| 3275 | Like has_capability, but when F's st_dev says it's on a file |
| 3276 | system lacking capability support, return 0 with ENOTSUP immediately. */ |
| 3277 | static bool |
| 3278 | has_capability_cache (char const *file, struct fileinfo *f) |
| 3279 | { |
| 3280 | /* If UNSUPPORTED_CACHED, UNSUPPORTED_DEVICE is the cached |
| 3281 | st_dev of the most recently processed device for which we've |
| 3282 | found that has_capability fails indicating lack of support. */ |
| 3283 | static bool unsupported_cached; |
| 3284 | static dev_t unsupported_device; |
| 3285 | |
| 3286 | if (f->stat_ok && unsupported_cached && f->stat.st_dev == unsupported_device) |
| 3287 | { |
| 3288 | errno = ENOTSUP; |
| 3289 | return 0; |
| 3290 | } |
| 3291 | |
| 3292 | bool b = has_capability (file); |
| 3293 | if (f->stat_ok && !b && !acl_errno_valid (errno)) |
| 3294 | { |
| 3295 | unsupported_cached = true; |
| 3296 | unsupported_device = f->stat.st_dev; |
| 3297 | } |
| 3298 | return b; |
| 3299 | } |
| 3300 | |
| 3301 | static bool |
| 3302 | needs_quoting (char const *name) |
no test coverage detected