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.
This commit is contained in:
Yu Watanabe
2025-07-10 14:02:00 +09:00
parent e28d408c6b
commit bd068e2903
+7 -1
View File
@@ -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) {