From: Lennart Poettering Date: Wed, 10 Mar 2021 16:49:42 +0000 (+0100) Subject: execute: drop DissectImageFlags parameter from namespace_setup() X-Git-Tag: v249-rc1~509^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9cb1709b72c89b33e290b44b60e0e47befe9a0c1;p=thirdparty%2Fsystemd.git execute: drop DissectImageFlags parameter from namespace_setup() The function already has a ridiculous amount of paramaters, let's drop one that is either not used at all or has a constant value and let's pick it internally. --- diff --git a/src/core/execute.c b/src/core/execute.c index e791c31b279..b644b51b01c 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -3247,7 +3247,6 @@ static int apply_mount_namespace( propagate_dir, incoming_dir, root_dir || root_image ? params->notify_socket : NULL, - DISSECT_IMAGE_DISCARD_ON_LOOP|DISSECT_IMAGE_RELAX_VAR_CHECK|DISSECT_IMAGE_FSCK|DISSECT_IMAGE_USR_NO_ROOT, error_path); /* If we couldn't set up the namespace this is probably due to a missing capability. setup_namespace() reports diff --git a/src/core/namespace.c b/src/core/namespace.c index 56385270d86..f7ebf9e6404 100644 --- a/src/core/namespace.c +++ b/src/core/namespace.c @@ -1802,7 +1802,6 @@ int setup_namespace( const char *propagate_dir, const char *incoming_dir, const char *notify_socket, - DissectImageFlags dissect_image_flags, char **error_path) { _cleanup_(loop_device_unrefp) LoopDevice *loop_device = NULL; @@ -1813,6 +1812,13 @@ int setup_namespace( MountEntry *m = NULL, *mounts = NULL; bool require_prefix = false, setup_propagate = false; const char *root, *extension_dir = "/run/systemd/unit-extensions"; + DissectImageFlags dissect_image_flags = + DISSECT_IMAGE_GENERIC_ROOT | + DISSECT_IMAGE_REQUIRE_ROOT | + DISSECT_IMAGE_DISCARD_ON_LOOP | + DISSECT_IMAGE_RELAX_VAR_CHECK | + DISSECT_IMAGE_FSCK | + DISSECT_IMAGE_USR_NO_ROOT; size_t n_mounts; int r; @@ -1825,8 +1831,6 @@ int setup_namespace( mount_flags = MS_SHARED; if (root_image) { - dissect_image_flags |= DISSECT_IMAGE_GENERIC_ROOT | DISSECT_IMAGE_REQUIRE_ROOT; - /* Make the whole image read-only if we can determine that we only access it in a read-only fashion. */ if (root_read_only(read_only_paths, ns_info->protect_system) && diff --git a/src/core/namespace.h b/src/core/namespace.h index 2806db8fd1b..737d6eae8b1 100644 --- a/src/core/namespace.h +++ b/src/core/namespace.h @@ -143,7 +143,6 @@ int setup_namespace( const char *propagate_dir, const char *incoming_dir, const char *notify_socket, - DissectImageFlags dissected_image_flags, char **error_path); #define RUN_SYSTEMD_EMPTY "/run/systemd/empty" diff --git a/src/test/test-namespace.c b/src/test/test-namespace.c index bf4b87e8a67..34eb6d40b8e 100644 --- a/src/test/test-namespace.c +++ b/src/test/test-namespace.c @@ -187,7 +187,6 @@ static void test_protect_kernel_logs(void) { NULL, NULL, NULL, - 0, NULL); assert_se(r == 0); diff --git a/src/test/test-ns.c b/src/test/test-ns.c index 761ee5da866..ae666a3019a 100644 --- a/src/test/test-ns.c +++ b/src/test/test-ns.c @@ -107,7 +107,6 @@ int main(int argc, char *argv[]) { NULL, NULL, NULL, - 0, NULL); if (r < 0) { log_error_errno(r, "Failed to set up namespace: %m");