diff options
author | Daniel Walton <dwalton@cumulusnetworks.com> | 2015-10-16 22:53:03 +0200 |
---|---|---|
committer | Daniel Walton <dwalton@cumulusnetworks.com> | 2015-10-16 22:53:03 +0200 |
commit | f35a5350975a943f4f219fcb708e2e5ef15597e1 (patch) | |
tree | 400840245d34fe58a6160852e53d14d416c4b528 /vtysh | |
parent | quagga errors parsing a valid config (diff) | |
download | frr-f35a5350975a943f4f219fcb708e2e5ef15597e1.tar.xz frr-f35a5350975a943f4f219fcb708e2e5ef15597e1.zip |
quagga crashes on 'show run bgp'
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'vtysh')
-rw-r--r-- | vtysh/vtysh.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 6d5f3c9e9..54e3e4f6c 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -101,6 +101,19 @@ vclient_close (struct vtysh_client *vclient) } } +/* Return true if str begins with prefix, else return false */ +static int +begins_with(const char *str, const char *prefix) +{ + if (!str || !prefix) + return 0; + size_t lenstr = strlen(str); + size_t lenprefix = strlen(prefix); + if (lenprefix > lenstr) + return 0; + return strncmp(str, prefix, lenprefix) == 0; +} + /* Following filled with debug code to trace a problematic condition * under load - it SHOULD handle it. */ #define ERR_WHERE_STRING "vtysh(): vtysh_client_config(): " @@ -1999,7 +2012,7 @@ DEFUN (vtysh_write_terminal_daemon, for (i = 0; i < array_size(vtysh_client); i++) { - if (strcmp(vtysh_client[i].name, argv[0]) == 0) + if (begins_with(vtysh_client[i].name, argv[0])) break; } @@ -2492,19 +2505,6 @@ vtysh_connect (struct vtysh_client *vclient) return 0; } -/* Return true if str begins with prefix, else return false */ -static int -begins_with(const char *str, const char *prefix) -{ - if (!str || !prefix) - return 0; - size_t lenstr = strlen(str); - size_t lenprefix = strlen(prefix); - if (lenprefix > lenstr) - return 0; - return strncmp(str, prefix, lenprefix) == 0; -} - /* Return true if str ends with suffix, else return false */ static int ends_with(const char *str, const char *suffix) |