The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/3582

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
We accidently used the "bytes_to_write" variable after we've written all the
bytes at which point it is guaranteed to be 0. Let's use the "bytes_read"
variable instead.

Signed-off-by: Christian Brauner <christian.brau...@ubuntu.com>
From 7d84e2cd65e120146001fa19127f61af0e0d7306 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brau...@ubuntu.com>
Date: Tue, 17 Nov 2020 22:34:05 +0100
Subject: [PATCH] file_utils: fix config file parsing

We accidently used the "bytes_to_write" variable after we've written all the
bytes at which point it is guaranteed to be 0. Let's use the "bytes_read"
variable instead.

Signed-off-by: Christian Brauner <christian.brau...@ubuntu.com>
---
 src/lxc/file_utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lxc/file_utils.c b/src/lxc/file_utils.c
index 3b4bffb399..a8d9aaf304 100644
--- a/src/lxc/file_utils.c
+++ b/src/lxc/file_utils.c
@@ -399,6 +399,7 @@ ssize_t __fd_to_fd(int from, int to)
                        break;
 
                bytes_to_write = (size_t)bytes_read;
+               total_bytes += bytes_read;
                do {
                        ssize_t bytes_written;
 
@@ -409,7 +410,6 @@ ssize_t __fd_to_fd(int from, int to)
                        bytes_to_write -= bytes_written;
                        p += bytes_written;
                } while (bytes_to_write > 0);
-               total_bytes += bytes_to_write;
        }
 
        return total_bytes;
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to