]> git.puffer.fish Git - mirror/frr.git/commitdiff
vtysh: more multi-instance fixing 1259/head
authorQuentin Young <qlyoung@cumulusnetworks.com>
Thu, 28 Sep 2017 18:01:05 +0000 (14:01 -0400)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Thu, 28 Sep 2017 18:01:05 +0000 (14:01 -0400)
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>
vtysh/vtysh.c

index 05d0ac561205bb5eedce5618d8f5e1fe4692058e..73440461ecd33b2bf32ce0686517855d0caa8941 100644 (file)
@@ -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);