From dan@obluda.cz  Sun Sep 12 17:36:27 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 C10A616A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 12 Sep 2004 17:36:27 +0000 (GMT)
Received: from kulesh.obluda.cz (kulesh.obluda.cz [193.179.22.243])
	by mx1.FreeBSD.org (Postfix) with ESMTP id B9CAE43D41
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 12 Sep 2004 17:36:26 +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 i8CHaOqv010914
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 12 Sep 2004 19:36:25 +0200 (CEST)
	(envelope-from dan@obluda.cz)
Received: (from root@localhost)
	by kulesh.obluda.cz (8.13.1/8.13.1/Submit) id i8CHaO0i010913
	for FreeBSD-gnats-submit@freebsd.org; Sun, 12 Sep 2004 19:36:24 +0200 (CEST)
	(envelope-from dan@obluda.cz)
Message-Id: <200409121736.i8CHaO0i010913@kulesh.obluda.cz>
Date: Sun, 12 Sep 2004 19:36:24 +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/btxld code
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         71666
>Category:       bin
>Synopsis:       [PATCH] cleanup of the usr.sbin/btxld code
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    delphij
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Sep 12 17:40:25 GMT 2004
>Closed-Date:    Fri May 12 02:29:28 GMT 2006
>Last-Modified:  Fri May 12 02:29:28 GMT 2006
>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/btxld/btxld.c,v 1.8 2004/06/22 17:05:37 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/btxld/btxld.c:339: warning: implicit declaration of function `ntohl'

>How-To-Repeat:
	N/A
>Fix:
*** btxld.c.ORIG	Wed Jun 23 00:00:27 2004
--- btxld.c	Sun Sep 12 16:18:05 2004
***************
*** 43,48 ****
--- 43,49 ----
  #include <stdlib.h>
  #include <string.h>
  #include <unistd.h>
+ #include <netinet/in.h>
  
  #include "btx.h"
  #include "elfh.h"
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->analyzed 
State-Changed-By: delphij 
State-Changed-When: Thu Jul 14 15:38:05 GMT 2005 
State-Changed-Why:  
Looks like something that I have similiar patch... 


Responsible-Changed-From-To: freebsd-bugs->delphij 
Responsible-Changed-By: delphij 
Responsible-Changed-When: Thu Jul 14 15:38:05 GMT 2005 
Responsible-Changed-Why:  
Claim this as I am going to fix it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=71666 

From: Dan Lukes <dan@obluda.cz>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/71666: [PATCH] cleanup of the usr.sbin/btxld code
Date: Fri, 15 Jul 2005 03:18:13 +0200

 This is a multi-part message in MIME format.
 --------------020104060800050306010909
 Content-Type: text/plain; charset=ISO-8859-2; format=flowed
 Content-Transfer-Encoding: 7bit
 
 	Well, in advance, following patch adresses remaining warnings.
 
 	The snprintf casting to (unsigned int) is correct because snprintf 
 never return negative value.
 
 	The write can return negative value, but it has been tested 
 separatelly, so later casting to (size_t) should be OK also.
 
 	The default WARNS can be raised to 6
 
 					Dan
 
 --------------020104060800050306010909
 Content-Type: text/plain;
  name="x"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="x"
 
 --- btxld.c.ORIG	Tue Jun 22 19:05:37 2004
 +++ btxld.c	Fri Jul 15 03:13:21 2005
 @@ -246,7 +246,7 @@
      }
      btx.btx_pgctl -= cwr;
      btx.btx_entry = Eflag ? centry : ihdr.entry;
 -    if (snprintf(name, sizeof(name), "%s.tmp", oname) >= sizeof(name))
 +    if ((unsigned int)snprintf(name, sizeof(name), "%s.tmp", oname) >= sizeof(name))
  	errx(2, "%s: Filename too long", oname);
      if ((fdo = open(name, O_CREAT | O_TRUNC | O_WRONLY, 0666)) == -1)
  	err(2, "%s", name);
 @@ -476,7 +476,7 @@
  
      if ((n = write(fd, buf, nbyte)) == -1)
  	err(2, "%s", tname);
 -    if (n != nbyte)
 +    if ((size_t)n != nbyte)
  	errx(2, "%s: Short write", tname);
  }
  
 --- usr.sbin/btxld/Makefile.ORIG	Wed Jun 23 00:00:27 2004
 +++ usr.sbin/btxld/Makefile	Fri Jul 15 03:06:35 2005
 @@ -4,4 +4,6 @@
  MAN=	btxld.8
  SRCS=	btxld.c elfh.c
  
 +WARNS?=	6
 +
  .include <bsd.prog.mk>
 
 --------------020104060800050306010909--
State-Changed-From-To: analyzed->patched 
State-Changed-By: delphij 
State-Changed-When: Mon Jan 23 13:57:34 UTC 2006 
State-Changed-Why:  
A slightly different patch applied against -HEAD.  MFC Reminder. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=71666 
State-Changed-From-To: patched->closed 
State-Changed-By: delphij 
State-Changed-When: Fri May 12 02:29:07 UTC 2006 
State-Changed-Why:  
Patch MFC'ed to RELENG_6.  Thanks for your submission! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=71666 
>Unformatted:
