From 197e3b7f77da456cae84274bdebecccad2dd7e35 Mon Sep 17 00:00:00 2001 From: "Peter W. Draper" <p.w.draper@durham.ac.uk> Date: Mon, 22 Oct 2018 18:50:04 +0100 Subject: [PATCH] Increase buffers to accept longest possible int format -Werror=format-truncation requires this --- examples/main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/main.c b/examples/main.c index 116d422c9a..fb48f41123 100644 --- a/examples/main.c +++ b/examples/main.c @@ -1057,8 +1057,8 @@ int main(int argc, char *argv[]) { #ifdef WITH_MPI /* Make sure output file is empty, only on one rank. */ - char dumpfile[30]; - snprintf(dumpfile, 30, "thread_info_MPI-step%d.dat", j + 1); + char dumpfile[35]; + snprintf(dumpfile, sizeof(dumpfile), "thread_info_MPI-step%d.dat", j + 1); FILE *file_thread; if (myrank == 0) { file_thread = fopen(dumpfile, "w"); @@ -1114,8 +1114,8 @@ int main(int argc, char *argv[]) { } #else - char dumpfile[30]; - snprintf(dumpfile, 30, "thread_info-step%d.dat", j + 1); + char dumpfile[32]; + snprintf(dumpfile, sizeof(dumpfile), "thread_info-step%d.dat", j + 1); FILE *file_thread; file_thread = fopen(dumpfile, "w"); /* Add some information to help with the plots */ -- GitLab