From 820b39f9ef2fcb4fb014d2a96c941d08c5ff5355 Mon Sep 17 00:00:00 2001 From: Anis Ellouze Date: Thu, 10 Sep 2015 11:24:28 +0100 Subject: [PATCH] avoid endless while loop --- dm/dmtree/landevice.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/dm/dmtree/landevice.c b/dm/dmtree/landevice.c index 984a487..a3798d3 100644 --- a/dm/dmtree/landevice.c +++ b/dm/dmtree/landevice.c @@ -2837,14 +2837,12 @@ inline int entry_landevice_lanethernetinterfaceconfig(struct dmctx *ctx, struct dmuci_get_value_by_section_string(landevice_section, "ifname", &ifname); ifname = dmstrdup(ifname); - pch = strtok_r(ifname, " ", &spch); - while (pch != NULL) { + for(pch = strtok_r(ifname, " ", &spch); pch != NULL; pch = strtok_r(NULL, " ", &spch)) { if (strncmp(pch, "eth", 3) != 0 || strncmp(pch, wan_eth, 4) == 0) continue; init_ldargs_eth_cfg(ctx, pch); sprintf(ieth, "%d", ++i); SUBENTRY(entry_landevice_lanethernetinterfaceconfig_instance, ctx, idev, ieth); - pch = strtok_r(NULL, " ", &spch); } dmfree(ifname); return 0;