From 6eda8faaa32ddc289d71923de6f00392de8a639e Mon Sep 17 00:00:00 2001 From: Lukasz Pawelczyk Date: Wed, 29 Apr 2020 18:29:53 +0200 Subject: [PATCH] Clarify the code that caused many sleepless engineers We have to stop this madness. Change-Id: I7407efe46ac02c0c2427966eb4bd52db180522fc --- src/debug.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/debug.c b/src/debug.c index e23214b..1e6035d 100644 --- a/src/debug.c +++ b/src/debug.c @@ -104,13 +104,16 @@ void error_dump(const char *file, int line, const char *function, int code) } } + /* In case the while broke early due to the BUF_SIZE, write + * ellipsis and clear remaining errors that might have not been + * read by ERR_get_error() */ if (written >= BUF_SIZE - 1) { strncpy(buf + BUF_SIZE - ELLIPSIS_SIZE, ELLIPSIS, ELLIPSIS_SIZE); written = BUF_SIZE - 1; ERR_clear_error(); } - buf[written] = '\0'; + buf[written] = '\0'; (*error_cb)(buf); } -- 2.7.4