From 8076cb8d573236c3cbdbc8f04b35aff76da8762d Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Mon, 17 Sep 2018 13:18:36 +0200 Subject: extrace: use snprintf instead of strncpy to silence misleading -Wstringop-truncation --- extrace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extrace.c b/extrace.c index e28a29c..38f92c7 100644 --- a/extrace.c +++ b/extrace.c @@ -366,8 +366,8 @@ handle_msg(struct cn_msg *cn_hdr) fprintf(output, "%d", pid); if (show_exit) { putc('+', output); - strncpy(pid_db[i].cmdline, cmdline, CMDLINE_DB_MAX-1); - pid_db[i].cmdline[CMDLINE_DB_MAX-1] = 0; + snprintf(pid_db[i].cmdline, CMDLINE_DB_MAX, + "%s", cmdline); } if (show_user) { struct stat st; -- cgit 1.4.1