summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Franke <nobody@nowhere.ws>2016-06-14 20:07:09 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2016-10-20 20:28:26 -0400
commitce01a2ca3f4501b75e55fe325c150eb9c2ae329d (patch)
tree83354527a0bb7d2f8dea8eabd2632c27276b09d0
parent58093a791767e5c1e412a6d3fcbe6927f4ffda0b (diff)
vtysh: handle case if there is no match in "write terminal $daemon"
While the DEFUN should match the list of clients registered in vtysh, it seems better to handle the case explicitly instead of relying on the client list and the DEFUN signature being in sync. Signed-off-by: Christian Franke <chris@opensourcerouting.org> Signed-off-by: Christian Franke <chris@opensourcerouting.org> Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
-rw-r--r--vtysh/vtysh.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c
index 4b579ddbdb..a5e146c945 100644
--- a/vtysh/vtysh.c
+++ b/vtysh/vtysh.c
@@ -2409,6 +2409,9 @@ DEFUN (vtysh_write_terminal_daemon,
break;
}
+ if (i == array_size(vtysh_client))
+ return CMD_ERR_NO_MATCH;
+
ret = vtysh_client_execute(&vtysh_client[i], "show running-config\n", stdout);
return ret;