Merge pull request #4667 from geniusgogo/fix_rt_kprintf

fixed rt_kprintf %s precision print error.
This commit is contained in:
Bernard Xiong 2021-05-09 12:59:07 +08:00 committed by GitHub
commit 060183184b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -922,7 +922,7 @@ rt_int32_t rt_vsnprintf(char *buf,
s = va_arg(args, char *);
if (!s) s = "(NULL)";
len = rt_strlen(s);
for (len = 0; (len != field_width) && (s[len] != '\0'); len++);
#ifdef RT_PRINTF_PRECISION
if (precision > 0 && len > precision) len = precision;
#endif