MCPcopy Create free account
hub / github.com/coreutils/coreutils / has_capability_cache

Function has_capability_cache

src/ls.c:3277–3299  ·  view source on GitHub ↗

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. */

Source from the content-addressed store, hash-verified

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. */
3277static bool
3278has_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
3301static bool
3302needs_quoting (char const *name)

Callers 1

gobble_fileFunction · 0.85

Calls 1

has_capabilityFunction · 0.85

Tested by

no test coverage detected