From 32d742049ef6d3b0bf91f5cf2ea147d439ea827e Mon Sep 17 00:00:00 2001 From: John-Mark Gurney Date: Fri, 20 Jun 2003 04:54:27 +0000 Subject: [PATCH] fix problem with uninitalized ptr (from PR) other minor clean up. PR: bin/2785 Submitted by: mpp --- usr.sbin/bootparamd/callbootd/callbootd.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/usr.sbin/bootparamd/callbootd/callbootd.c b/usr.sbin/bootparamd/callbootd/callbootd.c index b7827ac5b95..5ed460857b5 100644 --- a/usr.sbin/bootparamd/callbootd/callbootd.c +++ b/usr.sbin/bootparamd/callbootd/callbootd.c @@ -20,6 +20,7 @@ static const char rcsid[] = #include #include #include +#include /* #define bp_address_u bp_address */ @@ -36,7 +37,7 @@ static void usage __P((void)); int printgetfile __P((bp_getfile_res *)); int printwhoami __P((bp_whoami_res *)); -int +bool_t eachres_whoami(resultp, raddr) bp_whoami_res *resultp; struct sockaddr_in *raddr; @@ -50,6 +51,7 @@ struct sockaddr_in *raddr; return(0); } +bool_t eachres_getfile(resultp, raddr) bp_getfile_res *resultp; struct sockaddr_in *raddr; @@ -95,11 +97,10 @@ char **argv; if ( ! broadcast ) { clnt = clnt_create(server,BOOTPARAMPROG, BOOTPARAMVERS, "udp"); + if ( clnt == NULL ) + errx(1, "could not contact bootparam server on host %s", server); } - if ( clnt == NULL ) - errx(1, "could not contact bootparam server on host %s", server); - switch (argc) { case 3: whoami_arg.client_address.address_type = IP_ADDR_TYPE; @@ -118,8 +119,10 @@ char **argv; } else { clnt_stat=clnt_broadcast(BOOTPARAMPROG, BOOTPARAMVERS, BOOTPARAMPROC_WHOAMI, - (xdrproc_t)xdr_bp_whoami_arg, (char *)&whoami_arg, - xdr_bp_whoami_res, (char *)&stat_whoami_res, + (xdrproc_t)xdr_bp_whoami_arg, + (char *)&whoami_arg, + (xdrproc_t)xdr_bp_whoami_res, + (char *)&stat_whoami_res, (resultproc_t)eachres_whoami); exit(0); } @@ -139,8 +142,10 @@ char **argv; } else { clnt_stat=clnt_broadcast(BOOTPARAMPROG, BOOTPARAMVERS, BOOTPARAMPROC_GETFILE, - xdr_bp_getfile_arg, (char *)&getfile_arg, - xdr_bp_getfile_res, (char *)&stat_getfile_res, + (xdrproc_t)xdr_bp_getfile_arg, + (char *)&getfile_arg, + (xdrproc_t)xdr_bp_getfile_res, + (char *)&stat_getfile_res, (resultproc_t)eachres_getfile); exit(0); }