Author: pjd
Date: Wed Feb  2 08:24:26 2011
New Revision: 218185
URL: http://svn.freebsd.org/changeset/base/218185

Log:
  Be prepared that hp_client or hp_server might be NULL now.
  
  MFC after:    1 week

Modified:
  head/sbin/hastd/proto.c

Modified: head/sbin/hastd/proto.c
==============================================================================
--- head/sbin/hastd/proto.c     Wed Feb  2 05:58:51 2011        (r218184)
+++ head/sbin/hastd/proto.c     Wed Feb  2 08:24:26 2011        (r218185)
@@ -83,10 +83,17 @@ proto_common_setup(const char *addr, str
                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
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to