]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
conf: switch to fd_to_fd() when copying mountinfo 3581/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Mon, 16 Nov 2020 11:30:18 +0000 (12:30 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Mon, 16 Nov 2020 13:41:36 +0000 (14:41 +0100)
Closes: #3580.
Link: https://bugzilla.kernel.org/show_bug.cgi?id=209971
Suggested-by: Joan Bruguera <joanbrugueram@gmail.com>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/conf.c

index d36d9063b6c2a3822beac0212c2e63e02f8cfeba..84d16d77495771f6c91a1f26001aa31a4d4e3774 100644 (file)
@@ -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;
        }