aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files/etc/functions.sh
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2010-08-14 00:45:15 +0000
committerJo-Philipp Wich <jow@openwrt.org>2010-08-14 00:45:15 +0000
commit63991ba875e46f40324352a5317d144465567833 (patch)
treed33580ca49e3f28b03fc6b93bcab0336ea64f471 /package/base-files/files/etc/functions.sh
parent6616951c15bef73a09da4cbbe2eb956e74e8b164 (diff)
downloadupstream-63991ba875e46f40324352a5317d144465567833.tar.gz
upstream-63991ba875e46f40324352a5317d144465567833.tar.bz2
upstream-63991ba875e46f40324352a5317d144465567833.zip
base-files, uci: properly revert list state on config_load This fixes a bug where lists end up with duplicate values if config_load was invoked multiple times.
SVN-Revision: 22629
Diffstat (limited to 'package/base-files/files/etc/functions.sh')
-rwxr-xr-xpackage/base-files/files/etc/functions.sh1
1 files changed, 1 insertions, 0 deletions
diff --git a/package/base-files/files/etc/functions.sh b/package/base-files/files/etc/functions.sh
index fa0ba0427b..d5ffc13535 100755
--- a/package/base-files/files/etc/functions.sh
+++ b/package/base-files/files/etc/functions.sh
@@ -97,6 +97,7 @@ list() {
local len
config_get len "$CONFIG_SECTION" "${varname}_LENGTH" 0
+ [ $len = 0 ] && append CONFIG_LIST_STATE "${CONFIG_SECTION}_${varname}"
len=$(($len + 1))
config_set "$CONFIG_SECTION" "${varname}_ITEM$len" "$value"
config_set "$CONFIG_SECTION" "${varname}_LENGTH" "$len"