From bbe92ea5ccb6946441cbd862dcf4796a67218626 Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Wed, 18 Oct 2023 19:23:42 +0800 Subject: [PATCH] core/namespace: merge if blocks --- src/core/namespace.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/core/namespace.c b/src/core/namespace.c index 7161ac64060..a9ea64be7a9 100644 --- a/src/core/namespace.c +++ b/src/core/namespace.c @@ -2524,12 +2524,10 @@ int setup_namespace(const NamespaceParameters *p, char **error_path) { if (mount(NULL, "/", NULL, mount_propagation_flag | MS_REC, NULL) < 0) return log_debug_errno(errno, "Failed to remount '/' with desired mount flags: %m"); - /* bind_mount_in_namespace() will MS_MOVE into that directory, and that's only - * supported for non-shared mounts. This needs to happen after remounting / or it will fail. */ - if (setup_propagate) { - if (mount(NULL, p->incoming_dir, NULL, MS_SLAVE, NULL) < 0) - return log_debug_errno(errno, "Failed to remount %s with MS_SLAVE: %m", p->incoming_dir); - } + /* bind_mount_in_namespace() will MS_MOVE into that directory, and that's only supported for + * non-shared mounts. This needs to happen after remounting / or it will fail. */ + if (setup_propagate && mount(NULL, p->incoming_dir, NULL, MS_SLAVE, NULL) < 0) + return log_debug_errno(errno, "Failed to remount %s with MS_SLAVE: %m", p->incoming_dir); return 0; } -- 2.47.3