From e28e4b95081671998827fe2edbd621a4a3c47bd9 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Wed, 13 Jun 2012 23:58:21 -0500 Subject: Fix an embarassing bug causing ls -l to segfault on 32 bit targets. --- toys/ls.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/toys/ls.c b/toys/ls.c index 6c770a6b..6d0050fd 100644 --- a/toys/ls.c +++ b/toys/ls.c @@ -407,8 +407,10 @@ static void listfiles(int dirfd, struct dirtree *indir) } else usr = getusername(st->st_uid); } - xprintf("%s% *d %s%s%s%s% *d %s ", perm, totals[2]+1, st->st_nlink, - usr, upad, grp, grpad, totals[5]+1, st->st_size, thyme); + // Coerce the st types into something we know we can print. + xprintf("%s% *ld %s%s%s%s% *"PRId64" %s ", perm, totals[2]+1, + (long)st->st_nlink, usr, upad, grp, grpad, totals[5]+1, + (int64_t)st->st_size, thyme); } if (flags & FLAG_q) { -- cgit v1.2.3