From fc30dc8a5461c5f1b97faef85d12ecc8aa759723 Mon Sep 17 00:00:00 2001 From: Guillaume Nault Date: Wed, 13 Feb 2013 13:49:00 +0100 Subject: cli: Notify user of failed commands Handle CLI_CMD_FAILED like other command errors (i.e. return 0 to the caller and send a generic error message). This makes the CLI handler to flush its input buffer, so that processing of the next command will be made correctly. This also makes the telnet handler to send its prompt message. Signed-off-by: Guillaume Nault --- accel-pppd/cli/cli.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'accel-pppd') diff --git a/accel-pppd/cli/cli.c b/accel-pppd/cli/cli.c index 202e42d..8b5f516 100644 --- a/accel-pppd/cli/cli.c +++ b/accel-pppd/cli/cli.c @@ -14,6 +14,7 @@ #include "memdebug.h" #define MAX_CMD_ITEMS 100 +#define MSG_FAILURE_ERROR "command failed\r\n" #define MSG_SYNTAX_ERROR "syntax error\r\n" #define MSG_INVAL_ERROR "invalid argument\r\n" #define MSG_UNKNOWN_CMD "command unknown\r\n" @@ -299,8 +300,10 @@ out_found: switch (err) { case CLI_CMD_EXIT: cln->disconnect(cln); - case CLI_CMD_FAILED: return -1; + case CLI_CMD_FAILED: + cli_send(cln, MSG_FAILURE_ERROR); + return 0; case CLI_CMD_SYNTAX: cli_send(cln, MSG_SYNTAX_ERROR); return 0; -- cgit v1.2.3