summaryrefslogtreecommitdiffhomepage
path: root/config.c
diff options
context:
space:
mode:
authorAlexandru Ardelean <ardeleanalex@gmail.com>2017-03-27 09:35:04 +0300
committerHans Dedecker <dedeckeh@gmail.com>2017-04-05 17:54:59 +0200
commit5fbd904e5b4ed87243c09c86adcfb17ae93aa4f5 (patch)
tree4e02b6ffb833d34a749c989907b4d95fb35acd45 /config.c
parent6e0acecbacdb5bf1ce0b71d4c2512eae4606be57 (diff)
netifd: propagate error code on netifd_reload()
The context is that we generate some of the UCI config for netifd via scripts/programs. Every once in a while, there's a goof when doing that UCI generation, and netifd prints out the error at stderr, but returns 0 (success) err-code. This change will fail the ubus call if UCI config is invalid or missing for /etc/config/network. Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com> Acked-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'config.c')
-rw-r--r--config.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/config.c b/config.c
index 0d965d3..2454e9b 100644
--- a/config.c
+++ b/config.c
@@ -393,16 +393,20 @@ config_init_wireless(void)
vlist_flush(&wdev->interfaces);
}
-void
+int
config_init_all(void)
{
+ int ret = 0;
+
uci_network = config_init_package("network");
if (!uci_network) {
fprintf(stderr, "Failed to load network config\n");
- return;
+ return -1;
}
uci_wireless = config_init_package("wireless");
+ if (!uci_wireless)
+ ret = -1;
vlist_update(&interfaces);
config_init = true;
@@ -426,4 +430,6 @@ config_init_all(void)
interface_refresh_assignments(false);
interface_start_pending();
wireless_start_pending();
+
+ return ret;
}