]> git.puffer.fish Git - matthieu/frr.git/commitdiff
2003-09-24 sowmini.varadhan@sun.com
authorpaul <paul>
Tue, 23 Sep 2003 23:46:01 +0000 (23:46 +0000)
committerpaul <paul>
Tue, 23 Sep 2003 23:46:01 +0000 (23:46 +0000)
* lib/if.c: (if_cmp_func) fix infinite loop if
  ifp1->name == ifp2->name

lib/if.c

index 30de6805ce65a9c100959848c001bf59737721dd..68e6e4a086474e5904a417a2abb17b4cb1bba35c 100644 (file)
--- a/lib/if.c
+++ b/lib/if.c
@@ -59,7 +59,7 @@ if_cmp_func (struct interface *ifp1, struct interface *ifp2)
   p1 = ifp1->name;
   p2 = ifp2->name;
 
-  while (1) {
+  while (*p1 && *p2) {
     /* look up to any number */
     l1 = strcspn(p1, "0123456789");
     l2 = strcspn(p2, "0123456789");
@@ -91,6 +91,11 @@ if_cmp_func (struct interface *ifp1, struct interface *ifp2)
     /* numbers were equal, lets do it again..
     (it happens with name like "eth123.456:789") */
   }
+  if (*p1)
+    return 1;
+  if (*p2)
+    return -1;
+  return 0;
 }
 
 /* Create new interface structure. */