Skip to content

Commit

Permalink
zpool_influxdb: fix -Werror=stringop-truncation
Browse files Browse the repository at this point in the history
Use strlcpy instead of problematic strncpy

Signed-off-by: George Melikov <mail@gmelikov.ru>
  • Loading branch information
gmelikov committed Jul 13, 2021
1 parent 03dba7a commit a29829f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions cmd/zpool_influxdb/zpool_influxdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -684,9 +684,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,
Expand Down

0 comments on commit a29829f

Please sign in to comment.