Skip to content

Commit 67cc223

Browse files
gmelikovbehlendorf
authored andcommitted
zpool_influxdb: fix -Werror=stringop-truncation
Use strlcpy instead of problematic strncpy Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Richard Elling <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: George Melikov <[email protected]> Closes #12344
1 parent be29f88 commit 67cc223

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

cmd/zpool_influxdb/zpool_influxdb.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -683,9 +683,8 @@ print_recursive_stats(stat_printer_f func, nvlist_t *nvroot,
683683

684684
if (descend && nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_CHILDREN,
685685
&child, &children) == 0) {
686-
(void) strncpy(vdev_name, get_vdev_name(nvroot, parent_name),
686+
(void) strlcpy(vdev_name, get_vdev_name(nvroot, parent_name),
687687
sizeof (vdev_name));
688-
vdev_name[sizeof (vdev_name) - 1] = '\0';
689688

690689
for (c = 0; c < children; c++) {
691690
print_recursive_stats(func, child[c], pool_name,

0 commit comments

Comments
 (0)