summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2008-02-09 18:08:05 +0000
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2008-02-09 18:08:05 +0000
commitd52e2fc6c944b8db9c5816bd64ebc86d3e189958 (patch)
treeb926222edaa1e1aa61ed889939dce48be1476992
parent9aab3598bc690b7f1c1ece7e69bdb04831b3d36e (diff)
don't fail on uci_load() with nonexisting config files, but return the right return code
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@10433 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r--package/uci/files/uci/lib/config/uci.sh8
1 files changed, 7 insertions, 1 deletions
diff --git a/package/uci/files/uci/lib/config/uci.sh b/package/uci/files/uci/lib/config/uci.sh
index 9428a349dc..f9a91df063 100644
--- a/package/uci/files/uci/lib/config/uci.sh
+++ b/package/uci/files/uci/lib/config/uci.sh
@@ -19,15 +19,21 @@
uci_load() {
local PACKAGE="$1"
+ local DATA
+ local RET
_C=0
export ${NO_EXPORT:+-n} CONFIG_SECTIONS=
export ${NO_EXPORT:+-n} CONFIG_NUM_SECTIONS=0
export ${NO_EXPORT:+-n} CONFIG_SECTION=
- eval "$(/sbin/uci ${LOAD_STATE:+-P /var/state} -S -n export "$PACKAGE")"
+ DATA="$(/sbin/uci ${LOAD_STATE:+-P /var/state} -S -n export "$PACKAGE" 2>/dev/null)"
+ RET="$?"
+ [ "$RET" != 0 -o -z "$DATA" ] || eval "$DATA"
+ unset DATA
${CONFIG_SECTION:+config_cb}
+ return "$RET"
}
uci_set_default() {