From: Mike Yuan Date: Wed, 18 Oct 2023 11:23:42 +0000 (+0800) Subject: core/namespace: merge if blocks X-Git-Tag: v255-rc1~197^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bbe92ea5ccb6946441cbd862dcf4796a67218626;p=thirdparty%2Fsystemd.git core/namespace: merge if blocks --- 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; }