From a39fc34bd6842ad1adc6144391071d8b1078667e Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Mon, 16 Nov 2020 12:30:18 +0100 Subject: [PATCH] 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 --- src/lxc/conf.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) 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; } -- 2.47.2