summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/hoststated/relay.c6
-rw-r--r--usr.sbin/relayd/relay.c6
2 files changed, 6 insertions, 6 deletions
diff --git a/usr.sbin/hoststated/relay.c b/usr.sbin/hoststated/relay.c
index d7eb3e9f3c9..3aca58e5cbb 100644
--- a/usr.sbin/hoststated/relay.c
+++ b/usr.sbin/hoststated/relay.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: relay.c,v 1.39 2007/09/05 08:48:42 reyk Exp $ */
+/* $OpenBSD: relay.c,v 1.40 2007/09/05 10:25:13 reyk Exp $ */
/*
* Copyright (c) 2006, 2007 Reyk Floeter <reyk@openbsd.org>
@@ -2364,10 +2364,10 @@ RB_GENERATE(proto_tree, protonode, nodes, relay_proto_cmp);
int
relay_session_cmp(struct session *a, struct session *b)
{
- struct relay *rlay = (struct relay *)a->relay;
+ struct relay *rlay = (struct relay *)b->relay;
struct protocol *proto = rlay->proto;
- if (proto->cmp != NULL)
+ if (proto != NULL && proto->cmp != NULL)
return ((*proto->cmp)(a, b));
return ((int)a->id - b->id);
diff --git a/usr.sbin/relayd/relay.c b/usr.sbin/relayd/relay.c
index d7eb3e9f3c9..3aca58e5cbb 100644
--- a/usr.sbin/relayd/relay.c
+++ b/usr.sbin/relayd/relay.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: relay.c,v 1.39 2007/09/05 08:48:42 reyk Exp $ */
+/* $OpenBSD: relay.c,v 1.40 2007/09/05 10:25:13 reyk Exp $ */
/*
* Copyright (c) 2006, 2007 Reyk Floeter <reyk@openbsd.org>
@@ -2364,10 +2364,10 @@ RB_GENERATE(proto_tree, protonode, nodes, relay_proto_cmp);
int
relay_session_cmp(struct session *a, struct session *b)
{
- struct relay *rlay = (struct relay *)a->relay;
+ struct relay *rlay = (struct relay *)b->relay;
struct protocol *proto = rlay->proto;
- if (proto->cmp != NULL)
+ if (proto != NULL && proto->cmp != NULL)
return ((*proto->cmp)(a, b));
return ((int)a->id - b->id);