diff options
author | Leah Neukirchen <leah@vuxu.org> | 2018-09-17 13:18:36 +0200 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2018-09-17 13:18:36 +0200 |
commit | 8076cb8d573236c3cbdbc8f04b35aff76da8762d (patch) | |
tree | c906aff12f9382ca3df56035cee27d13da399498 | |
parent | bfbf410ff5f8df4629fbb75596b492e8dfa4a910 (diff) | |
download | extrace-8076cb8d573236c3cbdbc8f04b35aff76da8762d.tar.gz extrace-8076cb8d573236c3cbdbc8f04b35aff76da8762d.tar.xz extrace-8076cb8d573236c3cbdbc8f04b35aff76da8762d.zip |
extrace: use snprintf instead of strncpy to silence misleading -Wstringop-truncation
-rw-r--r-- | extrace.c | 4 |
1 files 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; |