From d2dbdcab92f4795c1a614f0c0d2c5dee9c78e21a Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Mon, 5 Oct 2015 22:52:11 -0500 Subject: Fix bug in od that screwed up position indicator on arm and mips. --- toys/posix/od.c | 5 +++-- 1 file 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; -- cgit v1.2.3