summaryrefslogtreecommitdiffstats
path: root/lib/if.c
diff options
context:
space:
mode:
authorpaul <paul>2003-09-23 23:46:01 +0000
committerpaul <paul>2003-09-23 23:46:01 +0000
commit820185168fb936a9d9a74f79b87bc485338d0e4f (patch)
treee20e7a6de4e9d1491c577310d5c95e7a32f8a2b1 /lib/if.c
parent9d4089c8da64dfa892b93db3464f07eee258a4a3 (diff)
downloadquagga-820185168fb936a9d9a74f79b87bc485338d0e4f.tar.bz2
quagga-820185168fb936a9d9a74f79b87bc485338d0e4f.tar.xz
2003-09-24 sowmini.varadhan@sun.com
* lib/if.c: (if_cmp_func) fix infinite loop if ifp1->name == ifp2->name
Diffstat (limited to 'lib/if.c')
-rw-r--r--lib/if.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/if.c b/lib/if.c
index 30de6805..68e6e4a0 100644
--- 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. */