1
0
mirror of https://github.com/systemd/systemd.git synced 2025-11-06 20:24:43 +03:00

binfmt-util: rename binfmt_mounted() -> binfmt_mounted_and_writable()

As it does not only check if binfmt_misc is mounted, but also check if
it is writable.
This commit is contained in:
Yu Watanabe
2025-07-09 15:18:24 +09:00
parent bd068e2903
commit 9a33cbac7d
4 changed files with 9 additions and 9 deletions

View File

@@ -193,10 +193,10 @@ static int parse_argv(int argc, char *argv[]) {
return 1;
}
static int binfmt_mounted_warn(void) {
static int binfmt_mounted_and_writable_warn(void) {
int r;
r = binfmt_mounted();
r = binfmt_mounted_and_writable();
if (r < 0)
return log_error_errno(r, "Failed to check if /proc/sys/fs/binfmt_misc is mounted: %m");
if (r == 0)
@@ -222,7 +222,7 @@ static int run(int argc, char *argv[]) {
return disable_binfmt();
if (argc > optind) {
r = binfmt_mounted_warn();
r = binfmt_mounted_and_writable_warn();
if (r <= 0)
return r;
@@ -239,7 +239,7 @@ static int run(int argc, char *argv[]) {
if (arg_cat_flags != CAT_CONFIG_OFF)
return cat_config(files);
r = binfmt_mounted_warn();
r = binfmt_mounted_and_writable_warn();
if (r <= 0)
return r;

View File

@@ -11,7 +11,7 @@
#include "missing_magic.h"
#include "stat-util.h"
int binfmt_mounted(void) {
int binfmt_mounted_and_writable(void) {
_cleanup_close_ int fd = -EBADF;
int r;
@@ -43,7 +43,7 @@ int disable_binfmt(void) {
* We are a bit careful here, since binfmt_misc might still be an autofs which we don't want to
* trigger. */
r = binfmt_mounted();
r = binfmt_mounted_and_writable();
if (r < 0)
return log_warning_errno(r, "Failed to determine whether binfmt_misc is mounted: %m");
if (r == 0) {

View File

@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
int binfmt_mounted(void);
int binfmt_mounted_and_writable(void);
int disable_binfmt(void);

View File

@@ -3,8 +3,8 @@
#include "binfmt-util.h"
#include "tests.h"
TEST(binfmt_mounted) {
ASSERT_OK(binfmt_mounted());
TEST(binfmt_mounted_and_writable) {
ASSERT_OK(binfmt_mounted_and_writable());
}
DEFINE_TEST_MAIN(LOG_DEBUG);