summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/vlib/cli.c7
-rw-r--r--src/vlib/cli.h8
-rw-r--r--src/vpp/api/api.c2
3 files changed, 11 insertions, 6 deletions
diff --git a/src/vlib/cli.c b/src/vlib/cli.c
index 4e8f3ae5ae5..835cb87d13d 100644
--- a/src/vlib/cli.c
+++ b/src/vlib/cli.c
@@ -684,7 +684,7 @@ vlib_unix_error_report (vlib_main_t * vm, clib_error_t * error)
}
/* Process CLI input. */
-void
+int
vlib_cli_input (vlib_main_t * vm,
unformat_input_t * input,
vlib_cli_output_function_t * function, uword function_arg)
@@ -694,6 +694,7 @@ vlib_cli_input (vlib_main_t * vm,
clib_error_t *error;
vlib_cli_output_function_t *save_function;
uword save_function_arg;
+ int rv = 0;
save_function = cp->output_function;
save_function_arg = cp->output_function_arg;
@@ -713,11 +714,15 @@ vlib_cli_input (vlib_main_t * vm,
{
vlib_cli_output (vm, "%v", error->what);
vlib_unix_error_report (vm, error);
+ /* clib_error_return is unfortunately often called with a '0'
+ return code */
+ rv = error->code != 0 ? error->code : -1;
clib_error_free (error);
}
cp->output_function = save_function;
cp->output_function_arg = save_function_arg;
+ return rv;
}
/* Output to current CLI connection. */
diff --git a/src/vlib/cli.h b/src/vlib/cli.h
index a81e964bf97..13216dc4025 100644
--- a/src/vlib/cli.h
+++ b/src/vlib/cli.h
@@ -186,10 +186,10 @@ static __clib_unused vlib_cli_command_t __clib_unused_##x
void vlib_cli_output (struct vlib_main_t *vm, char *fmt, ...);
/* Process CLI input. */
-void vlib_cli_input (struct vlib_main_t *vm,
- unformat_input_t * input,
- vlib_cli_output_function_t * function,
- uword function_arg);
+int vlib_cli_input (struct vlib_main_t *vm,
+ unformat_input_t * input,
+ vlib_cli_output_function_t * function,
+ uword function_arg);
clib_error_t *vlib_cli_register (struct vlib_main_t *vm,
vlib_cli_command_t * c);
diff --git a/src/vpp/api/api.c b/src/vpp/api/api.c
index c5c2480ea87..b389a7a7a63 100644
--- a/src/vpp/api/api.c
+++ b/src/vpp/api/api.c
@@ -226,7 +226,7 @@ vl_api_cli_inband_t_handler (vl_api_cli_inband_t * mp)
unformat_init_string (&input, (char *) vl_api_from_api_string (&mp->cmd),
vl_api_string_len (&mp->cmd));
- vlib_cli_input (vm, &input, inband_cli_output, (uword) & out_vec);
+ rv = vlib_cli_input (vm, &input, inband_cli_output, (uword) & out_vec);
len = vec_len (out_vec);