summaryrefslogtreecommitdiff
path: root/lib/command.c
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2016-10-05 23:50:49 +0000
committerQuentin Young <qlyoung@cumulusnetworks.com>2016-10-05 23:50:49 +0000
commit3871154b720569b12e037af88ac2ea9e8a0a1ace (patch)
treecae3a13b9d3cb3257ecaf057a507157f72533da2 /lib/command.c
parent49d73233c3d789e2176187d57b26ba9439dfce11 (diff)
lib: Invalid commands are errors, fix msg formatting
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/command.c')
-rw-r--r--lib/command.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/command.c b/lib/command.c
index d2720e1161..6368ebffe1 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -284,14 +284,17 @@ cmd_free_strvec (vector v)
char *
cmd_concat_strvec (vector v)
{
- size_t strsize = 1;
+ size_t strsize = 0;
for (unsigned int i = 0; i < vector_active (v); i++)
if (vector_slot (v, i))
- strsize += strlen ((char *) vector_slot (v, i));
+ strsize += strlen ((char *) vector_slot (v, i)) + 1;
char *concatenated = calloc (sizeof (char), strsize);
for (unsigned int i = 0; i < vector_active (v); i++)
+ {
strlcat (concatenated, (char *) vector_slot (v, i), strsize);
+ strlcat (concatenated, " ", strsize);
+ }
return concatenated;
}
@@ -724,7 +727,7 @@ cmd_execute_command_real (vector vline,
default:
{} // C...
char *inputline = cmd_concat_strvec (vline);
- zlog_debug ("invalid command %s for node %d\n", inputline, vty->node);
+ zlog_err ("invalid command \"%s\" for node %d\n", inputline, vty->node);
free (inputline);
return CMD_ERR_NO_MATCH;
}