Subject: bin/3209: mdsetimage(8) wrong error message.
To: None <gnats-bugs@gnats.netbsd.org>
From: MINOURA Makoto <minoura@kw.netlaputa.or.jp>
List: netbsd-bugs
Date: 02/11/1997 22:09:26
>Number:         3209
>Category:       bin
>Synopsis:       mdsetimage(8) wrong error message.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Feb 11 06:20:00 1997
>Last-Modified:
>Originator:     MINOURA Makoto
>Organization:
MINOURA, Makoto <minoura@kw.netlaputa.or.jp>
Nakahara-ku Kawasaki-Shi, JAPAN
>Release:        Feb.10, 97 (JST)
>Environment:
System: NetBSD donald 1.2C NetBSD 1.2C (BOOTFD) #3: Tue Feb 11 16:30:19 JST 1997 root@donald:/usr/src/sys/arch/x68k/compile/BOOTFD x68k


>Description:
	The error message printed when the image is bigger than buffer
	is wrong because of missing the cast below.
>How-To-Repeat:
	| donald# mdsetimage -v netbsd miniroot-12C.fs
	| got symbols from netbsd
	| mapped netbsd
	| netbsd is an a.out binary
	| _md_root_size is at offset 0xaa3f8 in netbsd
	| _md_root_size has value 0x180000
	| _md_root_image is at offset 0xaa3fc in netbsd
	| mdsetimage: fs image (0 bytes) too big for buffer (2097152 bytes)

	The last line should be:
	| mdsetimage: fs image (2097152 bytes) too big for buffer (1572864 bytes)

>Fix:
*** mdsetimage.c.bak	Thu Jan  2 21:24:22 1997
--- mdsetimage.c	Tue Feb 11 21:58:44 1997
***************
*** 127,133 ****
  		errx(1, "fs image is too big");
  	if (fssb.st_size > md_root_size)
  		errx(1, "fs image (%ld bytes) too big for buffer (%d bytes)",
! 		   fssb.st_size, md_root_size);
  
  	if (verbose)
  		fprintf(stderr, "copying image from %s into %s\n", fsfile,
--- 127,133 ----
  		errx(1, "fs image is too big");
  	if (fssb.st_size > md_root_size)
  		errx(1, "fs image (%ld bytes) too big for buffer (%d bytes)",
! 		   (long int) fssb.st_size, md_root_size);
  
  	if (verbose)
  		fprintf(stderr, "copying image from %s into %s\n", fsfile,
>Audit-Trail:
>Unformatted: