lxc/0127-log-only-write-size-begin-if-buffer-is-full.patch
LiFeng 7b470b3cde lxc: internal change at 1.6
Change-Id: I5821dc8a44f724e59cee65e356dfae4fbae04f76
Signed-off-by: LiFeng <lifeng68@huawei.com>
2020-01-05 22:20:49 -05:00

27 lines
939 B
Diff

From 396928f93365c2eb6f19a3d0d87394fcd43dcef0 Mon Sep 17 00:00:00 2001
From: TanYifeng <tanyifeng1@huawei.com>
Date: Tue, 3 Dec 2019 22:43:25 -0500
Subject: [PATCH 127/138] log: only write (size - begin) if buffer is full
Signed-off-by: TanYifeng <tanyifeng1@huawei.com>
---
src/lxc/terminal.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/lxc/terminal.c b/src/lxc/terminal.c
index e81f57e..b547013 100644
--- a/src/lxc/terminal.c
+++ b/src/lxc/terminal.c
@@ -538,7 +538,7 @@ static int lxc_terminal_write_log_file(struct lxc_terminal *terminal, const char
* noting that it's a partial log line. */
if (buf == NULL || (begin == 0 && size == __BUF_CACHE_SIZE)) {
if (begin < size) {
- ret = lxc_logger_write(terminal, type, cache + begin, index - begin + 1);
+ ret = lxc_logger_write(terminal, type, cache + begin, size - begin);
if (ret < 0) {
WARN("Failed to log msg");
}
--
1.8.3.1