don't fail on uci_load() with nonexisting config files, but return the right return...
authorFelix Fietkau <nbd@openwrt.org>
Sat, 9 Feb 2008 18:08:05 +0000 (18:08 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Sat, 9 Feb 2008 18:08:05 +0000 (18:08 +0000)
SVN-Revision: 10433

package/uci/files/uci/lib/config/uci.sh

index 9428a349dccf9a4cde37467360cd6424971ac814..f9a91df063b8a30483a5f2bfefdfe9df627b7937 100644 (file)
 
 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() {