From: Kefu Chai Date: Mon, 7 May 2018 07:19:37 +0000 (+0800) Subject: test: silence -Wformat-truncation= warnings X-Git-Tag: v13.2.0~37^2~22 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f5c987ae996f592e2222aae108972f5e7e313345;p=ceph.git test: silence -Wformat-truncation= warnings 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 (cherry picked from commit ba3f82a46c7e6862d31b162ee2badd4773c00bb9) --- diff --git a/src/test/system/systest_runnable.cc b/src/test/system/systest_runnable.cc index 7a97f2ffbba..98cb1741a77 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) {