summaryrefslogtreecommitdiff
path: root/ethtool.c
diff options
context:
space:
mode:
Diffstat (limited to 'ethtool.c')
-rw-r--r--ethtool.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/ethtool.c b/ethtool.c
index ca8a757..0fc8d6b 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -2023,12 +2023,10 @@ static int do_gstats(int fd, struct ifreq *ifr)
/* todo - pretty-print the strings per-driver */
fprintf(stdout, "NIC statistics:\n");
for (i = 0; i < n_stats; i++) {
- char s[ETH_GSTRING_LEN];
-
- strncpy(s, (const char *) &strings->data[i * ETH_GSTRING_LEN],
- ETH_GSTRING_LEN);
- fprintf(stdout, " %s: %llu\n",
- s, stats->data[i]);
+ fprintf(stdout, " %.*s: %llu\n",
+ ETH_GSTRING_LEN,
+ &strings->data[i * ETH_GSTRING_LEN],
+ stats->data[i]);
}
free(strings);
free(stats);