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: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent 59c6b066
...@@ -399,6 +399,7 @@ ssize_t __fd_to_fd(int from, int to) ...@@ -399,6 +399,7 @@ ssize_t __fd_to_fd(int from, int to)
break; break;
bytes_to_write = (size_t)bytes_read; bytes_to_write = (size_t)bytes_read;
total_bytes += bytes_read;
do { do {
ssize_t bytes_written; ssize_t bytes_written;
...@@ -409,7 +410,6 @@ ssize_t __fd_to_fd(int from, int to) ...@@ -409,7 +410,6 @@ ssize_t __fd_to_fd(int from, int to)
bytes_to_write -= bytes_written; bytes_to_write -= bytes_written;
p += bytes_written; p += bytes_written;
} while (bytes_to_write > 0); } while (bytes_to_write > 0);
total_bytes += bytes_to_write;
} }
return total_bytes; return total_bytes;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment