diff options
| author | Thomas Weißschuh <thomas@t-8ch.de> | 2025-11-01 14:58:34 +0100 |
|---|---|---|
| committer | Thomas Weißschuh <thomas@t-8ch.de> | 2025-11-01 21:38:14 +0100 |
| commit | 6cdbe06519ebc235c3d0fbb8e0092ffc8abf0ce6 (patch) | |
| tree | 99101dc5957058797f3bfa3ed053224da344261d | |
| parent | 7492ca660b235cfea5cf78f1c3d5f0dc4e535545 (diff) | |
| download | util-linux-6cdbe06519ebc235c3d0fbb8e0092ffc8abf0ce6.tar.gz | |
fincore: do not fall back to mincore if cachestat fails with EPERM
cachestat() and mincore() both require that the tested file is
(potentially) writable by the current user. If this permission check
fails, cachestat() will return EPERM while mincore() will simply mark
all pages as resident in core, as a proper EPERM would violate its API
contract. But when cachestat() fails with EPERM we know that mincore()
will not return real data, so instead show an error message.
Reported-by: Christian Hesse <mail@eworm.de>
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
| -rw-r--r-- | misc-utils/fincore.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/misc-utils/fincore.c b/misc-utils/fincore.c index c297c10457..7ccec2a82e 100644 --- a/misc-utils/fincore.c +++ b/misc-utils/fincore.c @@ -370,7 +370,7 @@ static int fincore_fd (struct fincore_control *ctl, if (errno != ENOSYS || ctl->cachestat) warn(_("failed to do cachestat: %s"), st->name); - if (ctl->cachestat) + if (errno == EPERM || ctl->cachestat) return -errno; return mincore_fd(ctl, fd, st); |
