From 3d021845fb3da3ecb328f8817a723c879122b386 Mon Sep 17 00:00:00 2001 From: pjd Date: Wed, 2 Feb 2011 08:24:26 +0000 Subject: Be prepared that hp_client or hp_server might be NULL now. MFC after: 1 week --- sbin/hastd/proto.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/sbin/hastd/proto.c b/sbin/hastd/proto.c index a00a8ec5..6c8382f 100644 --- a/sbin/hastd/proto.c +++ b/sbin/hastd/proto.c @@ -83,10 +83,17 @@ proto_common_setup(const char *addr, struct proto_conn **connp, int side) return (-1); TAILQ_FOREACH(proto, &protos, hp_next) { - if (side == PROTO_SIDE_CLIENT) - ret = proto->hp_client(addr, &ctx); - else /* if (side == PROTO_SIDE_SERVER_LISTEN) */ - ret = proto->hp_server(addr, &ctx); + if (side == PROTO_SIDE_CLIENT) { + if (proto->hp_client == NULL) + ret = -1; + else + ret = proto->hp_client(addr, &ctx); + } else /* if (side == PROTO_SIDE_SERVER_LISTEN) */ { + if (proto->hp_server == NULL) + ret = -1; + else + ret = proto->hp_server(addr, &ctx); + } /* * ret == 0 - success * ret == -1 - addr is not for this protocol -- cgit v1.1