[LEDE-DEV] [PATCH uci 2/2] list: remove unncessary increment of n_section (FS#1182)

Hans Dedecker dedeckeh at gmail.com
Thu Dec 21 02:56:32 PST 2017


The package n_section counter is already incremented in uci_alloc_section;
so no need to increment it again in uci_fixup_section.

Signed-off-by: Hans Dedecker <dedeckeh at gmail.com>
---
Output of uci -n export foo before the fix

package foo
config foo 'cfg027389'
config foo 'cfg047389'
config bar 'cfg0660ba'
config bar 'cfg0860ba'

after the fix

package foo
config foo 'cfg017389'
config foo 'cfg027389'
config bar 'cfg0360ba'
config bar 'cfg0460ba'

 list.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/list.c b/list.c
index e78012b..0347138 100644
--- a/list.c
+++ b/list.c
@@ -175,7 +175,7 @@ static void uci_fixup_section(struct uci_context *ctx, struct uci_section *s)
 			break;
 		}
 	}
-	sprintf(buf, "cfg%02x%04x", ++s->package->n_section, hash % (1 << 16));
+	sprintf(buf, "cfg%02x%04x", s->package->n_section, hash % (1 << 16));
 	s->e.name = uci_strdup(ctx, buf);
 }
 
-- 
1.9.1




More information about the Lede-dev mailing list