]> git.puffer.fish Git - matthieu/frr.git/commitdiff
vtysh: 'x not running' redux
authorQuentin Young <qlyoung@cumulusnetworks.com>
Wed, 27 Sep 2017 15:36:22 +0000 (11:36 -0400)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Wed, 27 Sep 2017 15:36:22 +0000 (11:36 -0400)
when warning about daemons that are not running, make sure to handle the
multi instance case

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
vtysh/vtysh.c

index 3f86f3c9294d3475b46669b2a0b09ae391c5040c..05d0ac561205bb5eedce5618d8f5e1fe4692058e 100644 (file)
@@ -423,12 +423,20 @@ static int vtysh_execute_func(const char *line, int pager)
                }
 
                cmd_stat = CMD_SUCCESS;
+               struct vtysh_client *vc;
                for (i = 0; i < array_size(vtysh_client); i++) {
                        if (cmd->daemon & vtysh_client[i].flag) {
                                if (vtysh_client[i].fd < 0
                                    && (cmd->daemon == vtysh_client[i].flag)) {
-                                       fprintf(stderr, "%s is not running\n",
-                                               vtysh_client[i].name);
+                                       bool any_inst = false;
+                                       for (vc = &vtysh_client[i]; vc;
+                                            vc = vc->next)
+                                               any_inst = any_inst
+                                                          || (vc->fd > 0);
+                                       if (!any_inst)
+                                               fprintf(stderr,
+                                                       "%s is not running\n",
+                                                       vtysh_client[i].name);
                                        continue;
                                }
                                cmd_stat = vtysh_client_execute(