]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Ensure we have a state when comparing
authorRoy Marples <roy@marples.name>
Tue, 20 Jan 2009 16:02:46 +0000 (16:02 +0000)
committerRoy Marples <roy@marples.name>
Tue, 20 Jan 2009 16:02:46 +0000 (16:02 +0000)
if-pref.c

index 7a47833dab52dfdd5ab2f520ca79749145eeb4ae..56f0113248f05898075f09baedf41ea64e031c1c 100644 (file)
--- a/if-pref.c
+++ b/if-pref.c
@@ -36,6 +36,12 @@ ifcmp(struct interface *si, struct interface *ti)
 {
        int sill, till;
 
+       if (si->state && !ti->state)
+               return -1;
+       if (!si->state && ti->state)
+               return 1;
+       if (!si->state && !ti->state)
+               return 0;
        /* If one has a lease and the other not, it takes precedence. */
        if (si->state->new && !ti->state->new)
                return -1;