Skip to content

Commit

Permalink
rexec: check lseek() return value
Browse files Browse the repository at this point in the history
Not really needed buy ok.

Fixes: Coverity: 1472769
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Feb 8, 2021
1 parent 6f86b90 commit aff7ab7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lxc/rexec.c
Expand Up @@ -127,10 +127,13 @@ static void lxc_rexec_as_memfd(char **argv, char **envp, const char *memfd_name)
sent = lxc_sendfile_nointr(memfd >= 0 ? memfd : tmpfd, fd, NULL,
st.st_size - bytes_sent);
if (sent < 0) {
/* Fallback to shoveling data between kernel- and
/*
* Fallback to shoveling data between kernel- and
* userspace.
*/
lseek(fd, 0, SEEK_SET);
if (lseek(fd, 0, SEEK_SET) == (off_t) -1)
fprintf(stderr, "Failed to seek to beginning of file");

if (fd_to_fd(fd, memfd >= 0 ? memfd : tmpfd))
break;

Expand Down

0 comments on commit aff7ab7

Please sign in to comment.