]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/namespace: merge if blocks
authorMike Yuan <me@yhndnzj.com>
Wed, 18 Oct 2023 11:23:42 +0000 (19:23 +0800)
committerMike Yuan <me@yhndnzj.com>
Thu, 19 Oct 2023 13:37:33 +0000 (21:37 +0800)
src/core/namespace.c

index 7161ac64060085436c1e087ea0d6c933aed2fa50..a9ea64be7a9fa70900ca8d4eb96a114247d399e4 100644 (file)
@@ -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;
 }