]> git.proxmox.com Git - mirror_lxc.git/commitdiff
attach: don't return early when calculating namespaces via pidfd
authorChristian Brauner <christian.brauner@ubuntu.com>
Mon, 12 Apr 2021 15:23:24 +0000 (17:23 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Mon, 12 Apr 2021 15:48:40 +0000 (17:48 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/attach.c

index 24590cf21b8471cd27ea0a6254677b8d89cbc9b6..04c8efc60499aa6f9f76bae0ebacc81251a7dda6 100644 (file)
@@ -534,9 +534,6 @@ static int __prepare_namespaces_pidfd(struct attach_context *ctx)
        for (int i = 0; i < LXC_NS_MAX; i++) {
                int ret;
 
-               if (!(ctx->ns_inherited & ns_info[i].clone_flag))
-                       continue;
-
                ret = same_nsfd(ctx->dfd_self_pid,
                                ctx->dfd_init_pid,
                                ns_info[i].proc_path);
@@ -545,10 +542,11 @@ static int __prepare_namespaces_pidfd(struct attach_context *ctx)
                        __fallthrough;
                case 1:
                        ctx->ns_inherited &= ~ns_info[i].clone_flag;
-                       break;
+                       TRACE("Shared %s namespace doesn't need attach", ns_info[i].proc_name);
+                       continue;
                case 0:
-                       TRACE("Shared %s namespace needs attach", ns_info[i].proc_name);
-                       break;
+                       TRACE("Different %s namespace needs attach", ns_info[i].proc_name);
+                       continue;
                }
 
                return syserror("Failed to determine whether %s namespace is shared",