diff options
author | paul <paul> | 2003-09-23 23:46:01 +0000 |
---|---|---|
committer | paul <paul> | 2003-09-23 23:46:01 +0000 |
commit | 90578521e5f332e65e97f7612485d04ace5c0ba5 (patch) | |
tree | bafe073096f587d8813aed705a5fac3e3eac6232 /lib/if.c | |
parent | 878ef2e7800e5e173b6c6b0875494f02fd3b93be (diff) |
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.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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. */ |