From: Christian Brauner Date: Wed, 3 Feb 2021 08:39:21 +0000 (+0100) Subject: rexec: check lseek() return value X-Git-Tag: lxc-5.0.0~303^2~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6b69d7f8cf73911213cc145efe6a79aff9977f58;p=thirdparty%2Flxc.git rexec: check lseek() return value Not really needed buy ok. Fixes: Coverity: 1472769 Signed-off-by: Christian Brauner --- diff --git a/src/lxc/rexec.c b/src/lxc/rexec.c index 95a038272..ba5cc0fe8 100644 --- a/src/lxc/rexec.c +++ b/src/lxc/rexec.c @@ -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;