From a99d45ac5960c25818b980683cb5920ffd25588c Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Thu, 12 Nov 2015 13:48:23 +0100 Subject: 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... --- src/vty/command.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'src/vty') 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 #include +#include /*! \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; -- cgit v1.2.3