rexec: check lseek() return value

Not really needed buy ok. Fixes: Coverity: 1472769 Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent 3c981fcb
...@@ -127,10 +127,13 @@ static void lxc_rexec_as_memfd(char **argv, char **envp, const char *memfd_name) ...@@ -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, sent = lxc_sendfile_nointr(memfd >= 0 ? memfd : tmpfd, fd, NULL,
st.st_size - bytes_sent); st.st_size - bytes_sent);
if (sent < 0) { if (sent < 0) {
/* Fallback to shoveling data between kernel- and /*
* Fallback to shoveling data between kernel- and
* userspace. * 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)) if (fd_to_fd(fd, memfd >= 0 ? memfd : tmpfd))
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment