mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-12 09:58:36 +00:00
Fix bin/ build with a 64-bit ino_t.
Original code by: Gleb Kurtsou
This commit is contained in:
parent
e25a029eb2
commit
6db1a7f11e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=241014
12
bin/ls/ls.c
12
bin/ls/ls.c
@ -561,7 +561,8 @@ display(const FTSENT *p, FTSENT *list, int options)
|
|||||||
NAMES *np;
|
NAMES *np;
|
||||||
off_t maxsize;
|
off_t maxsize;
|
||||||
long maxblock;
|
long maxblock;
|
||||||
u_long btotal, labelstrlen, maxinode, maxlen, maxnlink;
|
uintmax_t maxinode;
|
||||||
|
u_long btotal, labelstrlen, maxlen, maxnlink;
|
||||||
u_long maxlabelstr;
|
u_long maxlabelstr;
|
||||||
u_int sizelen;
|
u_int sizelen;
|
||||||
int maxflags;
|
int maxflags;
|
||||||
@ -580,8 +581,9 @@ display(const FTSENT *p, FTSENT *list, int options)
|
|||||||
btotal = 0;
|
btotal = 0;
|
||||||
initmax = getenv("LS_COLWIDTHS");
|
initmax = getenv("LS_COLWIDTHS");
|
||||||
/* Fields match -lios order. New ones should be added at the end. */
|
/* Fields match -lios order. New ones should be added at the end. */
|
||||||
maxlabelstr = maxblock = maxinode = maxlen = maxnlink =
|
maxlabelstr = maxblock = maxlen = maxnlink = 0;
|
||||||
maxuser = maxgroup = maxflags = maxsize = 0;
|
maxuser = maxgroup = maxflags = maxsize = 0;
|
||||||
|
maxinode = 0;
|
||||||
if (initmax != NULL && *initmax != '\0') {
|
if (initmax != NULL && *initmax != '\0') {
|
||||||
char *initmax2, *jinitmax;
|
char *initmax2, *jinitmax;
|
||||||
int ninitmax;
|
int ninitmax;
|
||||||
@ -609,7 +611,7 @@ display(const FTSENT *p, FTSENT *list, int options)
|
|||||||
strcpy(initmax2, "0");
|
strcpy(initmax2, "0");
|
||||||
|
|
||||||
ninitmax = sscanf(jinitmax,
|
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,
|
&maxinode, &maxblock, &maxnlink, &maxuser,
|
||||||
&maxgroup, &maxflags, &maxsize, &maxlen, &maxlabelstr);
|
&maxgroup, &maxflags, &maxsize, &maxlen, &maxlabelstr);
|
||||||
f_notabs = 1;
|
f_notabs = 1;
|
||||||
@ -839,7 +841,7 @@ display(const FTSENT *p, FTSENT *list, int options)
|
|||||||
d.s_flags = maxflags;
|
d.s_flags = maxflags;
|
||||||
d.s_label = maxlabelstr;
|
d.s_label = maxlabelstr;
|
||||||
d.s_group = maxgroup;
|
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);
|
d.s_nlink = snprintf(NULL, 0, "%lu", maxnlink);
|
||||||
sizelen = f_humanval ? HUMANVALSTR_LEN :
|
sizelen = f_humanval ? HUMANVALSTR_LEN :
|
||||||
snprintf(NULL, 0, "%ju", maxsize);
|
snprintf(NULL, 0, "%ju", maxsize);
|
||||||
|
@ -152,7 +152,8 @@ printlong(const DISPLAY *dp)
|
|||||||
continue;
|
continue;
|
||||||
sp = p->fts_statp;
|
sp = p->fts_statp;
|
||||||
if (f_inode)
|
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)
|
if (f_size)
|
||||||
(void)printf("%*jd ",
|
(void)printf("%*jd ",
|
||||||
dp->s_block, howmany(sp->st_blocks, blocksize));
|
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;
|
sp = p->fts_statp;
|
||||||
chcnt = 0;
|
chcnt = 0;
|
||||||
if (f_inode)
|
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)
|
if (f_size)
|
||||||
chcnt += printf("%*jd ",
|
chcnt += printf("%*jd ",
|
||||||
(int)sizefield, howmany(sp->st_blocks, blocksize));
|
(int)sizefield, howmany(sp->st_blocks, blocksize));
|
||||||
|
@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <fts.h>
|
#include <fts.h>
|
||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -429,8 +430,8 @@ rm_overwrite(char *file, struct stat *sbp)
|
|||||||
if (!S_ISREG(sbp->st_mode))
|
if (!S_ISREG(sbp->st_mode))
|
||||||
return (1);
|
return (1);
|
||||||
if (sbp->st_nlink > 1 && !fflag) {
|
if (sbp->st_nlink > 1 && !fflag) {
|
||||||
warnx("%s (inode %u): not overwritten due to multiple links",
|
warnx("%s (inode %ju): not overwritten due to multiple links",
|
||||||
file, sbp->st_ino);
|
file, (uintmax_t)sbp->st_ino);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
if ((fd = open(file, O_WRONLY|O_NONBLOCK|O_NOFOLLOW, 0)) == -1)
|
if ((fd = open(file, O_WRONLY|O_NONBLOCK|O_NOFOLLOW, 0)) == -1)
|
||||||
|
Loading…
Reference in New Issue
Block a user