[Yaffs] patch: mkyaffs printf format

Frank Rowand frowand@mvista.com
Tue, 14 Dec 2004 13:22:32 -0800


This is a multi-part message in MIME format.
--------------000101050906060608060002
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

In mkyaffs, the printf() of the blocks being erased and the blocks
that are damaged was using a format of "0x08%lx" instead of "0x%08lx",
so the value printed was prefixed with the constant "08" instead of
being set to a field width of 8.  The attached patch fixes the problem.

-Frank
-- 
Frank Rowand <frank_rowand@mvista.com>
MontaVista Software, Inc

--------------000101050906060608060002
Content-Type: text/plain;
 name="patch_printf_format"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="patch_printf_format"

diff -ruNp yaffs/utils/mkyaffs.c yaffs_new/utils/mkyaffs.c
--- yaffs/utils/mkyaffs.c	2003-03-12 11:54:07.000000000 -0800
+++ yaffs_new/utils/mkyaffs.c	2004-12-14 13:16:32.000000000 -0800
@@ -196,14 +196,14 @@ int main(int argc, char **argv)
 		
 		if(countBits[oobbuf[5]] < 7)
 		{
-			printf("Block at 0x08%lx is damaged and is not being formatted\n",addr);
+			printf("Block at 0x%08lx is damaged and is not being formatted\n",addr);
 		}
 		else
 		{
 			/* Erase this block */
 			erase.start = addr;
 			erase.length = meminfo.erasesize;
-			printf("Erasing block at 0x08%lx\n",addr);
+			printf("Erasing block at 0x%08lx\n",addr);
 			if(ioctl(fd, MEMERASE, &erase) != 0) 
 			{
 				perror("\nMTD Erase failure\n");

--------------000101050906060608060002--