From ba3f82a46c7e6862d31b162ee2badd4773c00bb9 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Mon, 7 May 2018 15:19:37 +0800 Subject: [PATCH] test: silence -Wformat-truncation= warnings MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit this change silences following warnings: : warning: ‘%s’ directive output may be truncated writing up to 127 bytes into a region of size between 109 and 119 [-W format-truncation=] snprintf(m_id_str, SysTestRunnable::ID_STR_SZ, "process_%d%s", m_id, extra); ^~~~~~~~~~~~~~ ~~~~~ Signed-off-by: Kefu Chai --- src/test/system/systest_runnable.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/test/system/systest_runnable.cc b/src/test/system/systest_runnable.cc index 7a97f2ffbba4..98cb1741a776 100644 --- a/src/test/system/systest_runnable.cc +++ b/src/test/system/systest_runnable.cc @@ -29,8 +29,9 @@ #include #include #include -#include #include +#include +#include using std::ostringstream; using std::string; @@ -176,7 +177,7 @@ void SysTestRunnable:: update_id_str(bool started) { bool use_threads = SysTestSettings::inst().use_threads(); - char extra[128]; + char extra[std::numeric_limits::digits10 + 1]; extra[0] = '\0'; if (started) { -- 2.47.3