summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2022-12-10 11:32:24 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2022-12-15 03:36:24 +0900
commit5aaa79ce96997825b4dcdcf5be10d8f955fb3339 (patch)
treefce20742c260abea4d1203a58e4a481debd25253
parenta51a9684c926af917ad1b8e2f34538aee3c7ce2d (diff)
downloadsystemd-5aaa79ce96997825b4dcdcf5be10d8f955fb3339.tar.gz
binfmt-util: also check if binfmt is mounted in read-write
-rw-r--r--src/shared/binfmt-util.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/shared/binfmt-util.c b/src/shared/binfmt-util.c
index e813c3ebcb..51fc245c01 100644
--- a/src/shared/binfmt-util.c
+++ b/src/shared/binfmt-util.c
@@ -8,6 +8,7 @@
#include "errno-util.h"
#include "fd-util.h"
#include "fileio.h"
+#include "fs-util.h"
#include "missing_magic.h"
#include "stat-util.h"
@@ -25,7 +26,7 @@ static int binfmt_mounted(void) {
if (r <= 0)
return r;
- return true;
+ return access_fd(fd, W_OK) >= 0;
}
int disable_binfmt(void) {
@@ -41,7 +42,7 @@ int disable_binfmt(void) {
if (r < 0)
return log_warning_errno(r, "Failed to determine whether binfmt_misc is mounted: %m");
if (r == 0) {
- log_debug("binfmt_misc is not mounted, not detaching entries.");
+ log_debug("binfmt_misc is not mounted in read-write mode, not detaching entries.");
return 0;
}