summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Ryzhov <iryzhov@nfware.com>2021-09-22 22:52:52 +0300
committerGitHub <noreply@github.com>2021-09-22 22:52:52 +0300
commita8a5b215148a1b5857085e4318a6e9af876453df (patch)
tree2937afc67c28fb5c8c643a070fdb87d41f433566
parente39ea7348622c1dfdd1c0325d07028b1de9045cb (diff)
parenta32f6a107fd2b9ed8295a6a3879c6aa2da3464d1 (diff)
Merge pull request #9429 from yar-fed/vtysh-err-not-running
vtysh: Add error code if daemon is not running
-rw-r--r--lib/command.h1
-rw-r--r--vtysh/vtysh.c5
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/command.h b/lib/command.h
index c76fc1e8eb..8a7c9a2048 100644
--- a/lib/command.h
+++ b/lib/command.h
@@ -229,6 +229,7 @@ struct cmd_node {
#define CMD_WARNING_CONFIG_FAILED 13
#define CMD_NOT_MY_INSTANCE 14
#define CMD_NO_LEVEL_UP 15
+#define CMD_ERR_NO_DAEMON 16
/* Argc max counts. */
#define CMD_ARGC_MAX 256
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c
index b74360c75f..beb7045a7d 100644
--- a/vtysh/vtysh.c
+++ b/vtysh/vtysh.c
@@ -602,7 +602,8 @@ static int vtysh_execute_func(const char *line, int pager)
fprintf(stderr,
"%s is not running\n",
vtysh_client[i].name);
- continue;
+ cmd_stat = CMD_ERR_NO_DAEMON;
+ break;
}
}
cmd_stat = vtysh_client_execute(
@@ -611,7 +612,7 @@ static int vtysh_execute_func(const char *line, int pager)
break;
}
}
- if (cmd_stat != CMD_SUCCESS)
+ if (cmd_stat != CMD_SUCCESS && cmd_stat != CMD_ERR_NO_DAEMON)
break;
if (cmd->func)