diff options
author | Felix Fietkau <nbd@openwrt.org> | 2008-02-09 18:08:05 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2008-02-09 18:08:05 +0000 |
commit | c86404e5a19e7eae5f654717598d5e9ea0c9d2ae (patch) | |
tree | b592d7cb83a1e8866e546ddbddeefba675614443 /package | |
parent | e1bb6ae6be49036050cf061bf1f1441482217f2e (diff) | |
download | mtk-20170518-c86404e5a19e7eae5f654717598d5e9ea0c9d2ae.zip mtk-20170518-c86404e5a19e7eae5f654717598d5e9ea0c9d2ae.tar.gz mtk-20170518-c86404e5a19e7eae5f654717598d5e9ea0c9d2ae.tar.bz2 |
don't fail on uci_load() with nonexisting config files, but return the right return code
SVN-Revision: 10433
Diffstat (limited to 'package')
-rw-r--r-- | package/uci/files/uci/lib/config/uci.sh | 8 |
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 9428a34..f9a91df 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() { |