diff toys/ls.c @ 597:b2d0e8e572ba

Fix an embarassing bug causing ls -l to segfault on 32 bit targets.
author Rob Landley <rob@landley.net>
date Wed, 13 Jun 2012 23:58:21 -0500
parents fb582378a36a
children 92200901cfe1
line wrap: on
line diff
--- a/toys/ls.c	Tue Jun 12 01:14:50 2012 -0500
+++ b/toys/ls.c	Wed Jun 13 23:58:21 2012 -0500
@@ -407,8 +407,10 @@
                 } 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) {