Skip to content

Commit

Permalink
Merge pull request #3779 from brauner/2021-04-12/attach_fixes
Browse files Browse the repository at this point in the history
attach: fixes
  • Loading branch information
stgraber committed Apr 12, 2021
2 parents d32dcd0 + 09a83db commit aeff7df
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
10 changes: 4 additions & 6 deletions src/lxc/attach.c
Expand Up @@ -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);
Expand All @@ -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",
Expand Down
3 changes: 0 additions & 3 deletions src/lxc/rexec.c
Expand Up @@ -162,9 +162,6 @@ static void lxc_rexec_as_memfd(char **argv, char **envp, const char *memfd_name)
if (execfd < 0)
return;

ret = close_range(STDERR_FILENO + 1, MAX_FILENO, CLOSE_RANGE_CLOEXEC);
if (ret && (errno != ENOSYS && errno != EINVAL))
fprintf(stderr, "%m - Failed to mark all file descriptors as close-on-exec\n");
fexecve(execfd, argv, envp);
}

Expand Down

0 comments on commit aeff7df

Please sign in to comment.