diff options
author | Daniel Willmann <daniel@totalueberwachung.de> | 2011-08-05 12:22:35 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2012-09-11 15:20:55 +0200 |
commit | 5e95f45af0e96c9f79d053de55a1cbd689496883 (patch) | |
tree | 16d1ea7f246c1e4cc3a48dde22e5f15ce38c0101 /openbsc/src/osmo-bsc | |
parent | 5ff06af6f560b9e906d6c320325ae84f3602f397 (diff) |
ctrl: Improve error handling if controlif setup fails
Diffstat (limited to 'openbsc/src/osmo-bsc')
-rw-r--r-- | openbsc/src/osmo-bsc/osmo_bsc_ctrl.c | 16 | ||||
-rw-r--r-- | openbsc/src/osmo-bsc/osmo_bsc_main.c | 10 |
2 files changed, 21 insertions, 5 deletions
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c b/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c index 1a24a2431..6bab46111 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c @@ -304,9 +304,17 @@ static int verify_net_rf_lock(struct ctrl_cmd *cmd, const char *value, void *dat return 0; } -void bsc_ctrl_cmds_install() +int bsc_ctrl_cmds_install() { - ctrl_cmd_install(CTRL_NODE_NET, &cmd_net_loc); - ctrl_cmd_install(CTRL_NODE_NET, &cmd_net_rf_lock); - ctrl_cmd_install(CTRL_NODE_TRX, &cmd_trx_rf_lock); + int rc; + + rc = ctrl_cmd_install(CTRL_NODE_NET, &cmd_net_loc); + if (rc) + goto end; + rc = ctrl_cmd_install(CTRL_NODE_NET, &cmd_net_rf_lock); + if (rc) + goto end; + rc = ctrl_cmd_install(CTRL_NODE_TRX, &cmd_trx_rf_lock); +end: + return rc; } diff --git a/openbsc/src/osmo-bsc/osmo_bsc_main.c b/openbsc/src/osmo-bsc/osmo_bsc_main.c index 0f70ceb36..bba6bc0e6 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_main.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_main.c @@ -213,8 +213,16 @@ int main(int argc, char **argv) bsc_api_init(bsc_gsmnet, osmo_bsc_api()); bsc_gsmnet->ctrl = controlif_setup(bsc_gsmnet, 4249); + if (!bsc_gsmnet) { + fprintf(stderr, "Failed to init the control interface. Exiting.\n"); + exit(1); + } - bsc_ctrl_cmds_install(); + rc = bsc_ctrl_cmds_install(); + if (rc < 0) { + fprintf(stderr, "Failed to install control commands. Exiting.\n"); + exit(1); + } data = bsc_gsmnet->bsc_data; if (rf_ctrl) |