1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #20596 from Teufelchen1/fix/esp_print

cpu/esp: Handle format print errors
This commit is contained in:
Teufelchen 2024-04-25 13:58:12 +00:00 committed by GitHub
commit 925644e4ce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -46,6 +46,16 @@ static int _lib_printf(int level, const char* tag, const char* format, va_list a
int len = vsnprintf(_printf_buf, PRINTF_BUFSIZ - 1, format, arg);
if (len < 0) {
ESP_EARLY_LOGI(tag, "Failed to format print");
return 0;
}
/* Did the output get truncated? */
if ((unsigned) len > PRINTF_BUFSIZ - 1) {
len = PRINTF_BUFSIZ - 1;
}
/*
* Since ESP_EARLY_LOG macros add a line break at the end, a terminating
* line break in the output must be removed if there is one.