From ce01a2ca3f4501b75e55fe325c150eb9c2ae329d Mon Sep 17 00:00:00 2001 From: Christian Franke Date: Tue, 14 Jun 2016 20:07:09 +0200 Subject: [PATCH] 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 Signed-off-by: Christian Franke Acked-by: Donald Sharp --- vtysh/vtysh.c | 3 +++ 1 file changed, 3 insertions(+) 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;