From: Christian Brauner Date: Mon, 16 Nov 2020 11:30:18 +0000 (+0100) Subject: conf: switch to fd_to_fd() when copying mountinfo X-Git-Tag: lxc-5.0.0~339^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F3581%2Fhead;p=thirdparty%2Flxc.git conf: switch to fd_to_fd() when copying mountinfo Closes: #3580. Link: https://bugzilla.kernel.org/show_bug.cgi?id=209971 Suggested-by: Joan Bruguera Signed-off-by: Christian Brauner --- diff --git a/src/lxc/conf.c b/src/lxc/conf.c index d36d9063b..84d16d774 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -2980,9 +2980,9 @@ void turn_into_dependent_mounts(void) __do_free char *line = NULL; __do_fclose FILE *f = NULL; __do_close int memfd = -EBADF, mntinfo_fd = -EBADF; - int ret; - ssize_t copied; size_t len = 0; + ssize_t copied; + int ret; mntinfo_fd = open("/proc/self/mountinfo", O_RDONLY | O_CLOEXEC); if (mntinfo_fd < 0) { @@ -3006,12 +3006,8 @@ void turn_into_dependent_mounts(void) } } -again: - copied = lxc_sendfile_nointr(memfd, mntinfo_fd, NULL, LXC_SENDFILE_MAX); + copied = fd_to_fd(mntinfo_fd, memfd); if (copied < 0) { - if (errno == EINTR) - goto again; - SYSERROR("Failed to copy \"/proc/self/mountinfo\""); return; }