mgmt/mcumgr/lib: Make version string work with CONFIG_NEWLIB_LIBC
By default the newlib does not compile with %hhu processing, to avoid turning on additional options for newlib compilation this commit changes formatting string to use %hu instead. The commit fixes problem with malformed version string being returned, by smp_svr, when CONFIG_NEWLIB_LIBC=y is set together with CONFIG_NEWLIB_LIBC_NANO=y. Fixes #45261 Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
This commit is contained in:
parent
0c051d0dd6
commit
578cb132ff
|
@ -16,8 +16,9 @@ img_mgmt_ver_str(const struct image_version *ver, char *dst)
|
|||
int rc = 0;
|
||||
int rc1 = 0;
|
||||
|
||||
rc = snprintf(dst, IMG_MGMT_VER_MAX_STR_LEN, "%hhu.%hhu.%hu",
|
||||
ver->iv_major, ver->iv_minor, ver->iv_revision);
|
||||
rc = snprintf(dst, IMG_MGMT_VER_MAX_STR_LEN, "%hu.%hu.%hu",
|
||||
(uint16_t)ver->iv_major, (uint16_t)ver->iv_minor,
|
||||
ver->iv_revision);
|
||||
|
||||
if (rc >= 0 && ver->iv_build_num != 0) {
|
||||
rc1 = snprintf(&dst[rc], IMG_MGMT_VER_MAX_STR_LEN - rc, ".%u",
|
||||
|
|
Loading…
Reference in a new issue