Subject: bin/10429: bad144(8) dosen't show disk device.
To: None <gnats-bugs@gnats.netbsd.org>
From: Takahiro Kambe <taca@sky.yamashina.kyoto.jp>
List: netbsd-bugs
Date: 06/23/2000 08:13:10
>Number:         10429
>Category:       bin
>Synopsis:       bad144(8) dosen't show disk device.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jun 23 08:14:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Takahiro Kambe
>Release:        NetBSD-current 2000/6/14
>Organization:
	
>Environment:
	
System: NetBSD edge.sky.yamashina.kyoto.jp 1.4ZD NetBSD 1.4ZD (CF-M33) #32: Thu Jun 15 08:58:49 JST 2000 taca@edge.sky.yamashina.kyoto.jp:/usr/src/sys/arch/i386/compile/CF-M33 i386


>Description:
	bad144(8) dosen't show disk device name.
>How-To-Repeat:
	# bad144 wd0
	bad block information at sector 23579073 in :
	cartridge serial number: 1234(10)

	Nothing is shown in ":".
>Fix:
	In bad144.c, global variable, "name" used for printing disk
	device file.  But main() stores disk name to local variable,
	"diskname".

--- bad144.c.~1~	Mon Mar 20 23:39:38 2000
+++ bad144.c	Sat Jun 24 00:08:33 2000
@@ -89,7 +89,7 @@
 char	label[BBSIZE];
 daddr_t	size;
 struct	disklabel *dp;
-char	name[BUFSIZ];
+char	diskname[MAXPATHLEN];
 
 daddr_t	badsn __P((const struct bt_bad *));
 int	blkcopy __P((int, daddr_t, daddr_t));
@@ -108,7 +108,6 @@
 	struct bt_bad *bt;
 	daddr_t	sn, bn[126];
 	int i, f, nbad, new, bad, errs;
-	char diskname[MAXPATHLEN];
 
 	argc--, argv++;
 	while (argc > 0 && **argv == '-') {
@@ -199,7 +198,7 @@
 	if (argc == 0) {
 		sn = getold(f, &oldbad);
 		printf("bad block information at sector %d in %s:\n",
-		    sn, name);
+		    sn, diskname);
 		printf("cartridge serial number: %d(10)\n", oldbad.bt_csn);
 		switch (oldbad.bt_flag) {
 
@@ -358,7 +357,7 @@
 		if (badfile != -1)
 			break;
 	}
-	errx(1, "%s: can't read bad block info", name);
+	errx(1, "%s: can't read bad block info", diskname);
 	/*NOTREACHED*/
 }
 
@@ -372,11 +371,11 @@
 
 	lsn = 0;
 	if (oldbad.bt_flag != DKBAD_MAGIC) {
-		warnx("%s: bad flag in bad-sector table", name);
+		warnx("%s: bad flag in bad-sector table", diskname);
 		errors++;
 	}
 	if (oldbad.bt_mbz != 0) {
-		warnx("%s: bad magic number", name);
+		warnx("%s: bad magic number", diskname);
 		errors++;
 	}
 	bt = oldbad.bt_bad;
>Release-Note:
>Audit-Trail:
>Unformatted: