summaryrefslogtreecommitdiffstats
path: root/bin
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
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')
-rw-r--r--bin/ls/ls.c12
-rw-r--r--bin/ls/print.c6
-rw-r--r--bin/rm/rm.c5
3 files changed, 14 insertions, 9 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);
diff --git a/bin/ls/print.c b/bin/ls/print.c
index a788042..5a0fc86 100644
--- a/bin/ls/print.c
+++ b/bin/ls/print.c
@@ -152,7 +152,8 @@ printlong(const DISPLAY *dp)
continue;
sp = p->fts_statp;
if (f_inode)
- (void)printf("%*lu ", dp->s_inode, (u_long)sp->st_ino);
+ (void)printf("%*ju ",
+ dp->s_inode, (uintmax_t)sp->st_ino);
if (f_size)
(void)printf("%*jd ",
dp->s_block, howmany(sp->st_blocks, blocksize));
@@ -328,7 +329,8 @@ printaname(const FTSENT *p, u_long inodefield, u_long sizefield)
sp = p->fts_statp;
chcnt = 0;
if (f_inode)
- chcnt += printf("%*lu ", (int)inodefield, (u_long)sp->st_ino);
+ chcnt += printf("%*ju ",
+ (int)inodefield, (uintmax_t)sp->st_ino);
if (f_size)
chcnt += printf("%*jd ",
(int)sizefield, howmany(sp->st_blocks, blocksize));
diff --git a/bin/rm/rm.c b/bin/rm/rm.c
index 6575a8d..a450057 100644
--- a/bin/rm/rm.c
+++ b/bin/rm/rm.c
@@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
#include <fts.h>
#include <grp.h>
#include <pwd.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -429,8 +430,8 @@ rm_overwrite(char *file, struct stat *sbp)
if (!S_ISREG(sbp->st_mode))
return (1);
if (sbp->st_nlink > 1 && !fflag) {
- warnx("%s (inode %u): not overwritten due to multiple links",
- file, sbp->st_ino);
+ warnx("%s (inode %ju): not overwritten due to multiple links",
+ file, (uintmax_t)sbp->st_ino);
return (0);
}
if ((fd = open(file, O_WRONLY|O_NONBLOCK|O_NOFOLLOW, 0)) == -1)
OpenPOWER on IntegriCloud