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:
@@ -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;
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user