Date: Thu, 27 Sep 2012 23:31:13 +0000 (UTC) From: Matthew D Fleming <mdf@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241014 - in head/bin: ls rm Message-ID: <201209272331.q8RNVDeT024002@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mdf Date: Thu Sep 27 23:31:12 2012 New Revision: 241014 URL: http://svn.freebsd.org/changeset/base/241014 Log: Fix bin/ build with a 64-bit ino_t. Original code by: Gleb Kurtsou Modified: head/bin/ls/ls.c head/bin/ls/print.c head/bin/rm/rm.c Modified: head/bin/ls/ls.c ============================================================================== --- head/bin/ls/ls.c Thu Sep 27 23:31:06 2012 (r241013) +++ head/bin/ls/ls.c Thu Sep 27 23:31:12 2012 (r241014) @@ -561,7 +561,8 @@ display(const FTSENT *p, FTSENT *list, i 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, i 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, i 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); Modified: head/bin/ls/print.c ============================================================================== --- head/bin/ls/print.c Thu Sep 27 23:31:06 2012 (r241013) +++ head/bin/ls/print.c Thu Sep 27 23:31:12 2012 (r241014) @@ -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 inode 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)); Modified: head/bin/rm/rm.c ============================================================================== --- head/bin/rm/rm.c Thu Sep 27 23:31:06 2012 (r241013) +++ head/bin/rm/rm.c Thu Sep 27 23:31:12 2012 (r241014) @@ -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 *sb 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)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209272331.q8RNVDeT024002>