summaryrefslogtreecommitdiffstats
path: root/bin/ls/ls.c
diff options
context:
space:
mode:
authormdf <mdf@FreeBSD.org>2012-09-27 23:31:12 +0000
committermdf <mdf@FreeBSD.org>2012-09-27 23:31:12 +0000
commit8ce8b3ae17aae9323001285d2530d9b793f3c36d (patch)
tree15b8dbeeffb836f977561b1d67149f3e1b1870b9 /bin/ls/ls.c
parente76336791156e518c57a0aa274e1652774931971 (diff)
downloadFreeBSD-src-8ce8b3ae17aae9323001285d2530d9b793f3c36d.zip
FreeBSD-src-8ce8b3ae17aae9323001285d2530d9b793f3c36d.tar.gz
Fix bin/ build with a 64-bit ino_t.
Original code by: Gleb Kurtsou
Diffstat (limited to 'bin/ls/ls.c')
-rw-r--r--bin/ls/ls.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/bin/ls/ls.c b/bin/ls/ls.c
index b6373e2..b96d18b 100644
--- a/bin/ls/ls.c
+++ b/bin/ls/ls.c
@@ -561,7 +561,8 @@ display(const FTSENT *p, FTSENT *list, int options)
NAMES *np;
off_t maxsize;
long maxblock;
- u_long btotal, labelstrlen, maxinode, maxlen, maxnlink;
+ uintmax_t maxinode;
+ u_long btotal, labelstrlen, maxlen, maxnlink;
u_long maxlabelstr;
u_int sizelen;
int maxflags;
@@ -580,8 +581,9 @@ display(const FTSENT *p, FTSENT *list, int options)
btotal = 0;
initmax = getenv("LS_COLWIDTHS");
/* Fields match -lios order. New ones should be added at the end. */
- maxlabelstr = maxblock = maxinode = maxlen = maxnlink =
- maxuser = maxgroup = maxflags = maxsize = 0;
+ maxlabelstr = maxblock = maxlen = maxnlink = 0;
+ maxuser = maxgroup = maxflags = maxsize = 0;
+ maxinode = 0;
if (initmax != NULL && *initmax != '\0') {
char *initmax2, *jinitmax;
int ninitmax;
@@ -609,7 +611,7 @@ display(const FTSENT *p, FTSENT *list, int options)
strcpy(initmax2, "0");
ninitmax = sscanf(jinitmax,
- " %lu : %ld : %lu : %u : %u : %i : %jd : %lu : %lu ",
+ " %ju : %ld : %lu : %u : %u : %i : %jd : %lu : %lu ",
&maxinode, &maxblock, &maxnlink, &maxuser,
&maxgroup, &maxflags, &maxsize, &maxlen, &maxlabelstr);
f_notabs = 1;
@@ -839,7 +841,7 @@ label_out:
d.s_flags = maxflags;
d.s_label = maxlabelstr;
d.s_group = maxgroup;
- d.s_inode = snprintf(NULL, 0, "%lu", maxinode);
+ d.s_inode = snprintf(NULL, 0, "%ju", maxinode);
d.s_nlink = snprintf(NULL, 0, "%lu", maxnlink);
sizelen = f_humanval ? HUMANVALSTR_LEN :
snprintf(NULL, 0, "%ju", maxsize);
OpenPOWER on IntegriCloud