[BusyBox] hexdump address not formatted correctly

Sauder, Vernon Vernon.Sauder at spirentcom.com
Thu Mar 4 21:57:46 UTC 2004


The off_t type is not a consistent size; it depends on the kernel options
(something about large file support). Therefore, the format string for
printing an address is not always the same. I chose to statically cast it to
the correct size for the format string for the purposes here. Here is a diff
on dump.c

--- ../dump.1.7.c	2004-03-04 15:09:53.000000000 -0500
+++ libbb/dump.c	2004-03-04 15:04:55.000000000 -0500
@@ -544,7 +544,7 @@
 /*                      PRINT; */
 						switch (pr->flags) {
 						case F_ADDRESS:
-							printf(pr->fmt,
address);
+							printf(pr->fmt,
(unsigned int)address);
 							break;
 						case F_BPAD:
 							printf(pr->fmt, "");
@@ -650,7 +650,7 @@
 		for (pr = endfu->nextpr; pr; pr = pr->nextpr) {
 			switch (pr->flags) {
 			case F_ADDRESS:
-				(void) printf(pr->fmt, eaddress);
+				(void) printf(pr->fmt, (unsigned
int)eaddress);
 				break;
 			case F_TEXT:
 				(void) printf(pr->fmt);


Vernon Sauder



More information about the busybox mailing list