From 270fa6daff0798dc50acf2e54fca1ab2e0434377 Mon Sep 17 00:00:00 2001 From: Justin Pettit Date: Tue, 12 Jul 2016 12:46:20 -0700 Subject: [PATCH] dpctl: Fix shadowed iterator in show_dpif(). Signed-off-by: Justin Pettit Acked-by: Daniele Di Proietto --- lib/dpctl.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/dpctl.c b/lib/dpctl.c index b870e30fd..003602a3e 100644 --- a/lib/dpctl.c +++ b/lib/dpctl.c @@ -577,13 +577,10 @@ show_dpif(struct dpif *dpif, struct dpctl_params *dpctl_p) smap_init(&config); error = netdev_get_config(netdev, &config); if (!error) { - const struct smap_node **nodes; - size_t i; - - nodes = smap_sort(&config); - for (i = 0; i < smap_count(&config); i++) { - const struct smap_node *node = nodes[i]; - dpctl_print(dpctl_p, "%c %s=%s", i ? ',' : ':', + const struct smap_node **nodes = smap_sort(&config); + for (size_t j = 0; j < smap_count(&config); j++) { + const struct smap_node *node = nodes[j]; + dpctl_print(dpctl_p, "%c %s=%s", j ? ',' : ':', node->key, node->value); } free(nodes); -- 2.20.1