From dan@obluda.cz  Sun Sep 12 17:36:32 2004
Return-Path: <dan@obluda.cz>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 50E0216A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 12 Sep 2004 17:36:32 +0000 (GMT)
Received: from kulesh.obluda.cz (kulesh.obluda.cz [193.179.22.243])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 1873943D53
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 12 Sep 2004 17:36:31 +0000 (GMT)
	(envelope-from dan@obluda.cz)
Received: from kulesh.obluda.cz (localhost.eunet.cz [127.0.0.1])
	by kulesh.obluda.cz (8.13.1/8.13.1) with ESMTP id i8CHaTRp010916
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 12 Sep 2004 19:36:29 +0200 (CEST)
	(envelope-from dan@obluda.cz)
Received: (from root@localhost)
	by kulesh.obluda.cz (8.13.1/8.13.1/Submit) id i8CHaSBp010915
	for FreeBSD-gnats-submit@freebsd.org; Sun, 12 Sep 2004 19:36:28 +0200 (CEST)
	(envelope-from dan@obluda.cz)
Message-Id: <200409121736.i8CHaSBp010915@kulesh.obluda.cz>
Date: Sun, 12 Sep 2004 19:36:28 +0200 (CEST)
From: Dan Lukes <dan@obluda.cz>
Reply-To: Dan Lukes <dan@obluda.cz>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [PATCH] cleanup of the usr.sbin/bootparamd code
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         71667
>Category:       bin
>Synopsis:       [patch] cleanup of the usr.sbin/bootparamd code
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Sep 12 17:40:26 GMT 2004
>Closed-Date:    
>Last-Modified:  Mon Dec 29 18:02:54 UTC 2008
>Originator:     Dan Lukes
>Release:        FreeBSD 5.3-BETA3 i386
>Organization:
Obludarium
>Environment:
System: FreeBSD kulesh.obluda.cz 5.3-BETA3 FreeBSD 5.3-BETA3 #8: Sun Sep 5 07:06:40 CEST 2004 dan@kulesh.obluda.cz:/usr/obj/usr/src/sys/Dan i386
usr.sbin/bootparamd/callbootd/callbootd.c,v 1.10 2003/06/20 04:54:27 jmg
include/rpcsvc/bootparam_prot.x,v 1.7 2003/05/04 02:51:42 obrien

>Description:
	There are more than 5000 warnings issued during "make buildworld".
Some of them are false positives, but some of them are sign of true errors.

	Nobody is upset by warnings due it's amount, so some errors remain
uncorrected.

	I want to cleanup the code-base from warnings, so warnings will
become "attention mark" again.

usr.sbin/bootparamd/callbootd/callbootd.c:83: warning: 'clnt' might be used uninitialized in this function
bootparam_prot_clnt.c:24: warning: implicit declaration of function `memset'

>How-To-Repeat:
	N/A
>Fix:
*** usr.sbin/bootparamd/callbootd/callbootd.c.ORIG	Tue Jul 15 22:47:06 2003
--- usr.sbin/bootparamd/callbootd/callbootd.c	Sun Sep 12 16:24:45 2004
***************
*** 80,86 ****
  
  
    long the_inet_addr;
!   CLIENT *clnt;
    enum clnt_stat clnt_stat;
  
    stat_whoami_res.client_name = cln;
--- 80,86 ----
  
  
    long the_inet_addr;
!   CLIENT *clnt = clnt; /* "init" to avoid "might be used uninitialized" warning */
    enum clnt_stat clnt_stat;
  
    stat_whoami_res.client_name = cln;
*** usr.sbin/bootparamd/../../include/rpcsvc/bootparam_prot.x.ORIG	Thu May 29 19:24:23 2003
--- usr.sbin/bootparamd/../../include/rpcsvc/bootparam_prot.x	Sun Sep 12 16:27:51 2004
***************
*** 39,44 ****
--- 39,45 ----
  
  #ifdef RPC_HDR
  %#include <rpc/types.h>
+ %#include <string.h>
  %#include <sys/time.h>
  %#include <sys/errno.h>
  %#include <sys/param.h>
>Release-Note:
>Audit-Trail:

From: Bruce Cran <bruce@cran.org.uk>
To: bug-followup@FreeBSD.org, dan@obluda.cz
Cc:  
Subject: Re: bin/71667: [PATCH] cleanup of the usr.sbin/bootparamd code
Date: Thu, 4 Sep 2008 19:10:13 +0100

 --MP_/dwsL/WnOOCR.BtgJirF=O2V
 Content-Type: text/plain; charset=US-ASCII
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline
 
 The bootparamd code needs quite a few more changes to make it compile
 with WARNS=6 with GCC 4.  I've attached a patch for
 callbootd/callbootd.c, but changes are also needed for
 bootparamd/bootparamd.c
 
 -- 
 Bruce Cran
 
 --MP_/dwsL/WnOOCR.BtgJirF=O2V
 Content-Type: text/x-patch; name=callbootd.c.diff
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment; filename=callbootd.c.diff
 
 --- callbootd.c.orig	2008-09-04 18:48:40.000000000 +0100
 +++ callbootd.c	2008-09-04 18:57:11.000000000 +0100
 @@ -32,15 +32,14 @@
  char cln[MAX_MACHINE_NAME+1];
  char dmn[MAX_MACHINE_NAME+1];
  char path[MAX_PATH_LEN+1];
 -extern char *inet_ntoa();
  static void usage(void);
  int printgetfile(bp_getfile_res *);
  int printwhoami(bp_whoami_res *);
 +bool_t eachres_whoami(bp_whoami_res *, struct sockaddr_in *);
 +bool_t eachres_getfile(bp_getfile_res *, struct sockaddr_in *);
  
  bool_t
 -eachres_whoami(resultp, raddr)
 -bp_whoami_res *resultp;
 -struct sockaddr_in *raddr;
 +eachres_whoami(bp_whoami_res *resultp, struct sockaddr_in *raddr)
  {
    struct hostent *he;
  
 @@ -52,9 +51,7 @@
  }
  
  bool_t
 -eachres_getfile(resultp, raddr)
 -bp_getfile_res *resultp;
 -struct sockaddr_in *raddr;
 +eachres_getfile(bp_getfile_res *resultp, struct sockaddr_in *raddr)
  {
    struct hostent *he;
  
 @@ -67,9 +64,7 @@
  
  
  int
 -main(argc, argv)
 -int argc;
 -char **argv;
 +main(int argc, char **argv)
  {
    char *server;
  
 @@ -80,7 +75,7 @@
  
  
    long the_inet_addr;
 -  CLIENT *clnt;
 +  CLIENT *clnt = NULL;
    enum clnt_stat clnt_stat;
  
    stat_whoami_res.client_name = cln;
 @@ -155,6 +150,7 @@
      usage();
    }
  
 +  return 0;
  }
  
  
 
 --MP_/dwsL/WnOOCR.BtgJirF=O2V--

From: Bruce Cran <bruce@cran.org.uk>
To: bug-followup@FreeBSD.org, dan@obluda.cz
Cc:  
Subject: Re: bin/71667: [PATCH] cleanup of the usr.sbin/bootparamd code
Date: Thu, 4 Sep 2008 23:01:35 +0100

 --MP_/kUvXmCHrH.M/W=UT6F4aYvq
 Content-Type: text/plain; charset=US-ASCII
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline
 
 I have attached a patch which fixes some of the problems with
 bootparamd/bootparamd.c and bootparamd/main.c.   More changes are
 required to bootparamd.c for it to compile with WARNS=6
 though.
 
 -- 
 Bruce Cran
 
 --MP_/kUvXmCHrH.M/W=UT6F4aYvq
 Content-Type: text/x-patch; name=bootparamd.c.diff
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment; filename=bootparamd.c.diff
 
 --- bootparamd.c.orig	2008-09-04 21:16:32.000000000 +0100
 +++ bootparamd.c	2008-09-04 22:54:29.000000000 +0100
 @@ -44,12 +44,11 @@
  int checkhost(char *, char *, int);
  
  bp_whoami_res *
 -bootparamproc_whoami_1_svc(whoami, req)
 -bp_whoami_arg *whoami;
 -struct svc_req *req;
 +bootparamproc_whoami_1_svc(bp_whoami_arg *whoami, struct svc_req *req)
  {
    in_addr_t haddr;
    static bp_whoami_res res;
 +  (void) req;
    if (debug)
      fprintf(stderr,"whoami got question for %d.%d.%d.%d\n",
  	    255 &  whoami->client_address.bp_address_u.ip_addr.net,
 @@ -110,13 +109,13 @@
  
  
  bp_getfile_res *
 -  bootparamproc_getfile_1_svc(getfile, req)
 -bp_getfile_arg *getfile;
 -struct svc_req *req;
 +bootparamproc_getfile_1_svc(bp_getfile_arg *getfile, struct svc_req *req)
  {
 -  char *where, *index();
 +  char *where;
    static bp_getfile_res res;
  
 +  (void) req;
 +
    if (debug)
      warnx("getfile got question for \"%s\" and file \"%s\"",
  	    getfile->client_name, getfile->file_id);
 @@ -184,10 +183,7 @@
        empty answer for the file "dump")   */
  
  int
 -getthefile(askname,fileid,buffer,blen)
 -char *askname;
 -char *fileid, *buffer;
 -int blen;
 +getthefile(char *askname,char *fileid,char *buffer,int blen)
  {
    FILE *bpf;
    char  *where;
 @@ -286,10 +282,7 @@
     name for a host in the database */
  
  int
 -checkhost(askname, hostname, len)
 -char *askname;
 -char *hostname;
 -int len;
 +checkhost(char *askname, char *hostname, int len)
  {
    int ch, pch;
    FILE *bpf;
 
 --MP_/kUvXmCHrH.M/W=UT6F4aYvq
 Content-Type: text/x-patch; name=main.c.diff
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment; filename=main.c.diff
 
 --- main.c.orig	2008-09-04 21:15:34.000000000 +0100
 +++ main.c	2008-09-04 21:16:23.000000000 +0100
 @@ -36,13 +36,11 @@
  struct sockaddr_in my_addr;
  char *bootpfile = "/etc/bootparams";
  
 -extern  void bootparamprog_1();
 +extern  void bootparamprog_1(void);
  static void usage(void);
  
  int
 -main(argc, argv)
 -int argc;
 -char **argv;
 +main(int argc, char **argv)
  {
  	SVCXPRT *transp;
  	struct hostent *he;
 @@ -107,10 +105,11 @@
  
  	svc_run();
  	errx(1, "svc_run returned");
 +	return 0;
  }
  
  static void
 -usage()
 +usage(void)
  {
  	fprintf(stderr,
  		"usage: bootparamd [-d] [-s] [-r router] [-f bootparmsfile]\n");
 
 --MP_/kUvXmCHrH.M/W=UT6F4aYvq--
>Unformatted:
