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...
diff --git a/src/vty/command.c b/src/vty/command.c
index 149eca3..1f1dddb 100644
--- a/src/vty/command.c
+++ b/src/vty/command.c
@@ -39,6 +39,7 @@
#include <osmocom/vty/command.h>
#include <osmocom/core/talloc.h>
+#include <osmocom/core/utils.h>
/*! \addtogroup command
* @{
@@ -323,11 +324,7 @@
cp++;
}
if (*cp == '|') {
- if (!multiple) {
- fprintf(stderr, "Command parse error!: %s\n",
- string);
- exit(1);
- }
+ OSMO_ASSERT(multiple);
cp++;
}
@@ -554,12 +551,7 @@
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 @@
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;