Skip to content

Commit

Permalink
rexec: avoid double-close
Browse files Browse the repository at this point in the history
Fixes: Coverity 1461721.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Apr 15, 2020
1 parent cd86470 commit 67e7246
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lxc/rexec.c
Expand Up @@ -88,7 +88,7 @@ static int is_memfd(void)
static void lxc_rexec_as_memfd(char **argv, char **envp, const char *memfd_name)
{
__do_close int execfd = -EBADF, fd = -EBADF, memfd = -EBADF,
tmpfd = -EBADF;
tmpfd = -EBADF;
int ret;
ssize_t bytes_sent = 0;
struct stat st = {0};
Expand Down Expand Up @@ -143,7 +143,7 @@ static void lxc_rexec_as_memfd(char **argv, char **envp, const char *memfd_name)
if (fcntl(memfd, F_ADD_SEALS, LXC_MEMFD_REXEC_SEALS))
return;

execfd = memfd;
execfd = move_fd(memfd);
} else {
char procfd[LXC_PROC_PID_FD_LEN];

Expand Down

0 comments on commit 67e7246

Please sign in to comment.