[PATCH] tools/lib: Fix the wrong format specifier in str_error_r

Luo Yifan posted 1 patch 1 year, 2 months ago
tools/lib/str_error_r.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] tools/lib: Fix the wrong format specifier in str_error_r
Posted by Luo Yifan 1 year, 2 months ago
Make a minor change to eliminate a static checker warning. The
variable buflen is unsigned, so the correct format specifier should
be %zu instead of %zd.

Signed-off-by: Luo Yifan <luoyifan@cmss.chinamobile.com>
---
 tools/lib/str_error_r.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/lib/str_error_r.c b/tools/lib/str_error_r.c
index 6aad8308a..276596a75 100644
--- a/tools/lib/str_error_r.c
+++ b/tools/lib/str_error_r.c
@@ -22,6 +22,6 @@ char *str_error_r(int errnum, char *buf, size_t buflen)
 {
 	int err = strerror_r(errnum, buf, buflen);
 	if (err)
-		snprintf(buf, buflen, "INTERNAL ERROR: strerror_r(%d, [buf], %zd)=%d", errnum, buflen, err);
+		snprintf(buf, buflen, "INTERNAL ERROR: strerror_r(%d, [buf], %zu)=%d", errnum, buflen, err);
 	return buf;
 }
-- 
2.27.0