Subject: bin/21202: dkctl.c will not compile in -current.
To: None <gnats-bugs@gnats.netbsd.org>
From: Lars-Johan Liman <liman@autonomica.se>
List: netbsd-bugs
Date: 04/16/2003 12:32:56
>Number:         21202
>Category:       bin
>Synopsis:       dkctl.c won't compile.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 16 10:34:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Lars-Johan Liman
>Release:        NetBSD 1.6R
>Organization:
#----------------------------------------------------------------------
# There are 10 kinds of people in the world. Those who understand
# binary numbers, and those who don't.
#----------------------------------------------------------------------
# Lars-Johan Liman, M.Sc.	! E-mail: liman@autonomica.se
# Senior Systems Specialist     ! HTTP  : //www.autonomica.se/
# Autonomica AB, Stockholm 	! Voice : +46 8 - 615 85 72
#----------------------------------------------------------------------
>Environment:
System: NetBSD naptop.autonomica.net 1.6I NetBSD 1.6I (GENERIC_LAPTOP) #0: Thu Oct 17 08:26:00 MEST 2002 liman@homburg.liman.sunet.se:/usr/obj/sys/arch/i386/compile/GENERIC_LAPTOP i386
Architecture: i386
Machine: i386
>Description:
	/usr/src/sbin/dkctl/dkctl.c in NetBSD current as of today
	will not compile, due to what seems to be a few minor quirks. An
	unused variable, and a few printf formatting warnings.

	archive:sbin/dkctl#/usr/src.scripts/manu-script.sh /usr/tools/bin/i386--netbsdelf-gcc -O2 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-sign-compare -Wno-uninitialized -Wreturn-type -Wswitch -Wshadow -Werror -nostdinc -isystem /usr/dest/usr/include -c dkctl.c
	cc1: warnings being treated as errors
	dkctl.c: In function `disk_badsectors':
	dkctl.c:311: warning: int format, different type arg (arg 3)
	dkctl.c:311: warning: int format, different type arg (arg 4)
	dkctl.c:406: warning: int format, different type arg (arg 3)
	dkctl.c:284: warning: unused variable `size'

	Suggested patch appended below. Please check it out. My claim
	to fame is nowhere near C programming. :-)

	The patch is made against

	/* $NetBSD: dkctl.c,v 1.4 2003/04/15 19:07:37 darrenr Exp $ */

>How-To-Repeat:
	cvs update -dP
	build.sh
	:-)

>Fix:

*** dkctl.c.orig	Wed Apr 16 12:06:15 2003
--- dkctl.c	Wed Apr 16 12:05:21 2003
***************
*** 281,287 ****
  	SLIST_HEAD(, disk_badsectors) dbstop;
  	struct disk_badsecinfo dbsi;
  	daddr_t blk, totbad, bad;
! 	u_int32_t count, size;
  	struct stat sb;
  	u_char *block;
  
--- 281,287 ----
  	SLIST_HEAD(, disk_badsectors) dbstop;
  	struct disk_badsecinfo dbsi;
  	daddr_t blk, totbad, bad;
! 	u_int32_t count;
  	struct stat sb;
  	u_char *block;
  
***************
*** 306,312 ****
  
  			dbs = (struct disk_badsectors *)dbsi.dbsi_buffer;
  			for (count = dbsi.dbsi_copied; count > 0; count--) {
! 				printf("%s: blocks %d - %d failed at %s",
  					dvname, dbs->dbs_min, dbs->dbs_max,
  					ctime(&dbs->dbs_failedat.tv_sec));
  				dbs++;
--- 306,312 ----
  
  			dbs = (struct disk_badsectors *)dbsi.dbsi_buffer;
  			for (count = dbsi.dbsi_copied; count > 0; count--) {
! 				printf("%s: blocks %lld - %lld failed at %s",
  					dvname, dbs->dbs_min, dbs->dbs_max,
  					ctime(&dbs->dbs_failedat.tv_sec));
  				dbs++;
***************
*** 402,408 ****
  			for (blk = dbs->dbs_min; blk <= dbs->dbs_max; blk++) {
  				if (lseek(fd, (off_t)blk * DEV_BSIZE,
  				    SEEK_SET) == -1) {
! 					warn("%s: lseek block %d", dvname,
  					     blk);
  					continue;
  				}
--- 402,408 ----
  			for (blk = dbs->dbs_min; blk <= dbs->dbs_max; blk++) {
  				if (lseek(fd, (off_t)blk * DEV_BSIZE,
  				    SEEK_SET) == -1) {
! 					warn("%s: lseek block %lld", dvname,
  					     blk);
  					continue;
  				}
>Release-Note:
>Audit-Trail:
>Unformatted: