aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ringlogger
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2021-03-04 18:17:56 -0700
committerJason A. Donenfeld <Jason@zx2c4.com>2021-03-05 16:05:13 -0700
commit4f9721a09d41a708222609fe0e24ed0754c0c258 (patch)
tree7a20405d6da76b281ec5f9a512c2487ed0c69e30 /ringlogger
parentmanager: use non-stuttering function name (diff)
downloadwireguard-windows-4f9721a09d41a708222609fe0e24ed0754c0c258.tar.xz
wireguard-windows-4f9721a09d41a708222609fe0e24ed0754c0c258.zip
ringlogger: trim lines that are too wide
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'ringlogger')
-rw-r--r--ringlogger/ringlogger.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/ringlogger/ringlogger.go b/ringlogger/ringlogger.go
index 3234e20b..718a94b5 100644
--- a/ringlogger/ringlogger.go
+++ b/ringlogger/ringlogger.go
@@ -136,6 +136,7 @@ func (rl *Ringlogger) Write(p []byte) (n int, err error) {
textLen := 3 + len(p) + len(rl.tag)
if textLen > maxLogLineLength-1 {
p = p[:maxLogLineLength-1-3-len(rl.tag)]
+ textLen = maxLogLineLength-1
}
line.line[textLen] = 0
line.line[0] = 0 // Null out the beginning and only let it extend after the other writes have completed