summaryrefslogtreecommitdiff
path: root/accel-pppd/cli
diff options
context:
space:
mode:
authorGuillaume Nault <g.nault@alphalink.fr>2013-02-13 13:49:00 +0100
committerKozlov Dmitry <xeb@mail.ru>2013-02-13 17:24:03 +0400
commitfc30dc8a5461c5f1b97faef85d12ecc8aa759723 (patch)
treeda04cd1b241f011929979270e34903ad6ff294e2 /accel-pppd/cli
parent7e14fe6e37890591e4d6c9a0f36b5ac19571a14e (diff)
downloadaccel-ppp-fc30dc8a5461c5f1b97faef85d12ecc8aa759723.tar.gz
accel-ppp-fc30dc8a5461c5f1b97faef85d12ecc8aa759723.zip
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 <g.nault@alphalink.fr>
Diffstat (limited to 'accel-pppd/cli')
-rw-r--r--accel-pppd/cli/cli.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/accel-pppd/cli/cli.c b/accel-pppd/cli/cli.c
index 202e42dc..8b5f5165 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;