]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
attach: use move_fd in lxc_proc_close_ns_fd 2881/head
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Mon, 25 Feb 2019 16:05:24 +0000 (17:05 +0100)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Mon, 25 Feb 2019 16:05:24 +0000 (17:05 +0100)
Previously this set `ctx->ns_fd[*]` to `-EBADF` until commit
fd2a88b190eb ("attach: cleanup macros lxc_proc_close_ns_fd",
but there are some code paths where we call this before
later calling `lxc_proc_put_context_info` which would call
this function again with the file descriptors still
unchanged.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
src/lxc/attach.c

index e00584178ba41d326c1fa723d50e774a5797d42a..288458230feae03b197c132322e5bd8380d0b23a 100644 (file)
@@ -126,7 +126,7 @@ static struct lxc_proc_context_info *lxc_proc_get_context_info(pid_t pid)
 static inline void lxc_proc_close_ns_fd(struct lxc_proc_context_info *ctx)
 {
        for (int i = 0; i < LXC_NS_MAX; i++) {
-               __do_close_prot_errno int fd = ctx->ns_fd[i];
+               __do_close_prot_errno int fd = move_fd(ctx->ns_fd[i]);
        }
 }