lxc/0127-log-only-write-size-begin-if-buffer-is-full.patch

27 lines
939 B
Diff
Raw Normal View History

From de46120969e9d164bb2d4926c16414daafa86063 Mon Sep 17 00:00:00 2001
2019-12-25 15:57:42 +08:00
From: TanYifeng <tanyifeng1@huawei.com>
Date: Tue, 3 Dec 2019 22:43:25 -0500
Subject: [PATCH 127/140] log: only write (size - begin) if buffer is full
2019-12-25 15:57:42 +08:00
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
2019-12-25 15:57:42 +08:00
--- 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
2019-12-25 15:57:42 +08:00