From: Quentin Young Date: Thu, 28 Sep 2017 18:01:05 +0000 (-0400) Subject: vtysh: more multi-instance fixing X-Git-Tag: frr-4.0-dev~254^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=91fd1b8d9cf692c8f88afc5900c2d1ad16a871e8;p=mirror%2Ffrr.git 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 --- 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);