zpool_influxdb: fix -Werror=stringop-truncation

Use strlcpy instead of problematic strncpy

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Richard Elling <Richard.Elling@RichardElling.com>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: George Melikov <mail@gmelikov.ru>
Closes #12344
This commit is contained in:
George Melikov 2021-07-16 23:04:00 +03:00 committed by Tony Hutter
parent 056c273939
commit f8c2e91db5
1 changed files with 1 additions and 2 deletions

View File

@ -683,9 +683,8 @@ print_recursive_stats(stat_printer_f func, nvlist_t *nvroot,
if (descend && nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_CHILDREN, if (descend && nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_CHILDREN,
&child, &children) == 0) { &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)); sizeof (vdev_name));
vdev_name[sizeof (vdev_name) - 1] = '\0';
for (c = 0; c < children; c++) { for (c = 0; c < children; c++) {
print_recursive_stats(func, child[c], pool_name, print_recursive_stats(func, child[c], pool_name,