Skip to content

Commit

Permalink
[MXCHIP] remove empty line for mbedtls log
Browse files Browse the repository at this point in the history
  • Loading branch information
mxchipwanges committed Mar 18, 2024
1 parent d727268 commit 870bb72
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/supplemental/tls/mbedtls/tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand Down

0 comments on commit 870bb72

Please sign in to comment.