From: Yu Watanabe Date: Tue, 8 Jul 2025 09:51:55 +0000 (+0900) Subject: binfmt-util: propagate failure in access_fd() X-Git-Tag: v258-rc1~109^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bd068e29030e9efef2ef692837ee60905d2812af;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/shared/binfmt-util.c b/src/shared/binfmt-util.c index c88ce2cd0e2..49d920c2925 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) {