summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2017-09-28 14:01:05 -0400
committerQuentin Young <qlyoung@cumulusnetworks.com>2017-09-28 14:01:05 -0400
commit91fd1b8d9cf692c8f88afc5900c2d1ad16a871e8 (patch)
tree58bc40d5977495dadb894fc2b1a7f3ff58f63d4c
parent2a1919940771db5c85d090f2c29926eccb4ba74f (diff)
vtysh: more multi-instance fixing
Preexisting code to detect commands targeted at wrong instance didn't work because a command applied to a disconnected vtysh_client counted as a successful run overriding wrong instance error message Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
-rw-r--r--vtysh/vtysh.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c
index 05d0ac5612..73440461ec 100644
--- a/vtysh/vtysh.c
+++ b/vtysh/vtysh.c
@@ -226,7 +226,8 @@ static int vtysh_client_run_all(struct vtysh_client *head_client,
wrong_instance++;
continue;
}
- correct_instance++;
+ if (client->fd > 0)
+ correct_instance++;
if (rc != CMD_SUCCESS) {
if (!continue_on_err)
return rc;
@@ -433,11 +434,12 @@ static int vtysh_execute_func(const char *line, int pager)
vc = vc->next)
any_inst = any_inst
|| (vc->fd > 0);
- if (!any_inst)
+ if (!any_inst) {
fprintf(stderr,
"%s is not running\n",
vtysh_client[i].name);
- continue;
+ continue;
+ }
}
cmd_stat = vtysh_client_execute(
&vtysh_client[i], line, fp);