From bd068e29030e9efef2ef692837ee60905d2812af Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 8 Jul 2025 18:51:55 +0900 Subject: [PATCH] binfmt-util: propagate failure in access_fd() It is not necessary to hide errors in access_fd(), and only acceptable errors here are -EROFS, -EACCES, and -EPERM. --- src/shared/binfmt-util.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/shared/binfmt-util.c b/src/shared/binfmt-util.c index c88ce2cd0e..49d920c292 100644 --- a/src/shared/binfmt-util.c +++ b/src/shared/binfmt-util.c @@ -25,7 +25,13 @@ int binfmt_mounted(void) { if (r <= 0) return r; - return access_fd(fd, W_OK) >= 0; + r = access_fd(fd, W_OK); + if (ERRNO_IS_NEG_FS_WRITE_REFUSED(r)) + return false; + if (r < 0) + return r; + + return true; } int disable_binfmt(void) {