aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2015-11-12 13:48:23 +0100
committerHarald Welte <laforge@gnumonks.org>2015-11-12 13:48:23 +0100
commita99d45ac5960c25818b980683cb5920ffd25588c (patch)
tree705076ab04ce14e41ecc967b1f1e1e1932abd7de
parent2b82c1c6c887656e2fc8c2ee4456ac93d5834e03 (diff)
vty: Don't call exit() but rather use OSMO_ASSERT()
This was pointed out by Jaroslav Skarvada during fedora packaging, and he has a valid point...
-rw-r--r--src/vty/command.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/src/vty/command.c b/src/vty/command.c
index 149eca38..1f1dddbe 100644
--- a/src/vty/command.c
+++ b/src/vty/command.c
@@ -39,6 +39,7 @@ Boston, MA 02110-1301, USA. */
#include <osmocom/vty/command.h>
#include <osmocom/core/talloc.h>
+#include <osmocom/core/utils.h>
/*! \addtogroup command
* @{
@@ -323,11 +324,7 @@ static vector cmd_make_descvec(const char *string, const char *descstr)
cp++;
}
if (*cp == '|') {
- if (!multiple) {
- fprintf(stderr, "Command parse error!: %s\n",
- string);
- exit(1);
- }
+ OSMO_ASSERT(multiple);
cp++;
}
@@ -554,12 +551,7 @@ void install_element(int ntype, struct cmd_element *cmd)
cnode = vector_slot(cmdvec, ntype);
- if (cnode == NULL) {
- fprintf(stderr,
- "Command node %d doesn't exist, please check it\n",
- ntype);
- exit(1);
- }
+ OSMO_ASSERT(cnode);
vector_set(cnode->cmd_vector, cmd);
@@ -2289,10 +2281,7 @@ gDEFUN(config_exit,
case AUTH_NODE:
case VIEW_NODE:
case ENABLE_NODE:
- if (0) //vty_shell (vty))
- exit(0);
- else
- vty->status = VTY_CLOSE;
+ vty->status = VTY_CLOSE;
break;
case CONFIG_NODE:
vty->node = ENABLE_NODE;