From f8c2e91db568bb57e8c805a5f947ff263fb87b24 Mon Sep 17 00:00:00 2001 From: George Melikov Date: Fri, 16 Jul 2021 23:04:00 +0300 Subject: [PATCH] zpool_influxdb: fix -Werror=stringop-truncation Use strlcpy instead of problematic strncpy Reviewed-by: Brian Behlendorf Reviewed-by: Richard Elling Reviewed-by: Ryan Moeller Signed-off-by: George Melikov Closes #12344 --- cmd/zpool_influxdb/zpool_influxdb.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmd/zpool_influxdb/zpool_influxdb.c b/cmd/zpool_influxdb/zpool_influxdb.c index 71ffcb2538..35c4770a1c 100644 --- a/cmd/zpool_influxdb/zpool_influxdb.c +++ b/cmd/zpool_influxdb/zpool_influxdb.c @@ -683,9 +683,8 @@ print_recursive_stats(stat_printer_f func, nvlist_t *nvroot, if (descend && nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_CHILDREN, &child, &children) == 0) { - (void) strncpy(vdev_name, get_vdev_name(nvroot, parent_name), + (void) strlcpy(vdev_name, get_vdev_name(nvroot, parent_name), sizeof (vdev_name)); - vdev_name[sizeof (vdev_name) - 1] = '\0'; for (c = 0; c < children; c++) { print_recursive_stats(func, child[c], pool_name,