aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2015-10-05 22:52:11 -0500
committerRob Landley <rob@landley.net>2015-10-05 22:52:11 -0500
commitd2dbdcab92f4795c1a614f0c0d2c5dee9c78e21a (patch)
treee61bd80b90f32e49df294a5246ec6e8dc6aab89c
parent1223578c94c1d409af481dd7af2fb84261c20c62 (diff)
downloadtoybox-d2dbdcab92f4795c1a614f0c0d2c5dee9c78e21a.tar.gz
Fix bug in od that screwed up position indicator on arm and mips.
-rw-r--r--toys/posix/od.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/toys/posix/od.c b/toys/posix/od.c
index 880432e1..8919ad16 100644
--- a/toys/posix/od.c
+++ b/toys/posix/od.c
@@ -125,7 +125,7 @@ static int od_out_t(struct odtype *t, char *buf, int *offset)
static void od_outline(void)
{
unsigned flags = toys.optflags;
- char buf[128], *abases[] = {"", "%07d", "%07o", "%06x"};
+ char buf[128], *abases[] = {"", "%07lld", "%07llo", "%06llx"};
struct odtype *types = (struct odtype *)toybuf;
int i, j, len, pad;
@@ -144,7 +144,8 @@ static void od_outline(void)
} else {
TT.star = 0;
- xprintf(abases[TT.address_idx], TT.pos);
+ // off_t varies so expand it to largest possible size
+ xprintf(abases[TT.address_idx], (long long)TT.pos);
if (!TT.leftover) {
if (TT.address_idx) xputc('\n');
return;