From 870bb72b9e782446bff670c284853c3147f47e15 Mon Sep 17 00:00:00 2001 From: mxchipwanges Date: Thu, 14 Mar 2024 18:40:40 +0800 Subject: [PATCH] [MXCHIP] remove empty line for mbedtls log --- src/supplemental/tls/mbedtls/tls.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/supplemental/tls/mbedtls/tls.c b/src/supplemental/tls/mbedtls/tls.c index 19b600e15..a7dc3f2cd 100644 --- a/src/supplemental/tls/mbedtls/tls.c +++ b/src/supplemental/tls/mbedtls/tls.c @@ -139,6 +139,7 @@ tls_dbg(void *ctx, int level, const char *file, int line, const char *s) { #ifdef CONFIG_MXCHIP_DEBUG_TLS char buf[256]; + int log_len; #else char buf[128]; #endif @@ -148,6 +149,14 @@ tls_dbg(void *ctx, int level, const char *file, int line, const char *s) // log_debug("****[mbedtls log(%d)] %s", level, buf); #ifdef CONFIG_MXCHIP_DEBUG_TLS + /* remove the '\n' at the end of the mbedtls log string, because it will be added by log_log api. */ + log_len = strlen(buf); + if(log_len < sizeof(buf)) { + buf[log_len - 1] = '\0'; + } + else { + buf[sizeof(buf) - 1] = '\0'; // in case of overflow + } log_log(mbedtls_log_level_to_nanomq(level), "tls.c", __LINE__, __FUNCTION__, "%s", buf); #else nni_plat_println(buf);