summaryrefslogtreecommitdiffstats
path: root/if-pref.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2009-01-20 16:02:46 +0000
committerRoy Marples <roy@marples.name>2009-01-20 16:02:46 +0000
commitd600f7076c1acdb0e9c7df6525590bc9921b109b (patch)
treef026c5f1107eba010bcbc98fd381d004fe2b8bbe /if-pref.c
parent882d97c856abe553fdc752457006ee85798adae1 (diff)
downloaddhcpcd-d600f7076c1acdb0e9c7df6525590bc9921b109b.tar.xz
Ensure we have a state when comparing
Diffstat (limited to 'if-pref.c')
-rw-r--r--if-pref.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/if-pref.c b/if-pref.c
index 7a47833d..56f01132 100644
--- 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;