]> git.puffer.fish Git - matthieu/frr.git/commitdiff
quagga crashes on 'show run bgp'
authorDaniel Walton <dwalton@cumulusnetworks.com>
Fri, 16 Oct 2015 20:53:03 +0000 (20:53 +0000)
committerDaniel Walton <dwalton@cumulusnetworks.com>
Fri, 16 Oct 2015 20:53:03 +0000 (20:53 +0000)
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
vtysh/vtysh.c

index 6d5f3c9e9a98c575447a1fe8c5bc86ea557de3bd..54e3e4f6c6a5ba938daa064455752e3b468cfbd0 100644 (file)
@@ -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)