Fix usr.bin/ and usr.sbin/ build with a 64-bit ino_t.

Original code by:	Gleb Kurtsou
This commit is contained in:
Matthew D Fleming 2012-09-27 23:31:19 +00:00
parent 6db1a7f11e
commit b424efd5b1
5 changed files with 12 additions and 9 deletions

View File

@ -63,7 +63,7 @@ printlong(char *name, char *accpath, struct stat *sb)
{
char modep[15];
(void)printf("%6lu %8"PRId64" ", (u_long) sb->st_ino, sb->st_blocks);
(void)printf("%6ju %8"PRId64" ", (uintmax_t)sb->st_ino, sb->st_blocks);
(void)strmode(sb->st_mode, modep);
(void)printf("%s %3u %-*s %-*s ", modep, sb->st_nlink, MAXLOGNAME - 1,
user_from_uid(sb->st_uid, 0), MAXLOGNAME - 1,

View File

@ -75,6 +75,7 @@ __FBSDID("$FreeBSD$");
#include <grp.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
@ -386,8 +387,8 @@ main(int argc, char *argv[])
continue; /* file unreasonable */
if (sflag && (cp = linked(arg)) != NULL) {
(void) snprintf(buf, sizeof(buf), "%u %u", statb.st_dev,
statb.st_ino);
(void)snprintf(buf, sizeof(buf), "%u %ju",
statb.st_dev, (uintmax_t)statb.st_ino);
card('S', buf);
if (format == 'p')
card('T', title ? title : arg);

View File

@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
#include <sys/time.h>
#include <errno.h>
#include <stdint.h>
#include "makefs.h"
@ -439,8 +440,8 @@ ffs_blkfree(struct inode *ip, daddr_t bno, long size)
}
cg = dtog(fs, bno);
if (bno >= fs->fs_size) {
warnx("bad block %lld, ino %llu", (long long)bno,
(unsigned long long)ip->i_number);
warnx("bad block %lld, ino %ju", (long long)bno,
(uintmax_t)ip->i_number);
return;
}
error = bread(ip->i_fd, ip->i_fs, fsbtodb(fs, cgtod(fs, cg)),

View File

@ -484,8 +484,8 @@ static void
donames(int fd, struct fs *super, char *name)
{
int c;
ino_t inode;
ino_t maxino;
uintmax_t inode;
union dinode *dp;
maxino = super->fs_ncg * super->fs_ipg - 1;
@ -493,9 +493,9 @@ donames(int fd, struct fs *super, char *name)
while ((c = getchar()) != EOF && (c < '0' || c > '9'))
while ((c = getchar()) != EOF && c != '\n');
ungetc(c,stdin);
while (scanf("%u",&inode) == 1) {
while (scanf("%ju", &inode) == 1) {
if (inode > maxino) {
warnx("illegal inode %d",inode);
warnx("illegal inode %ju", inode);
return;
}
errno = 0;

View File

@ -34,6 +34,7 @@
#include <errno.h>
#include <ftw.h>
#include <libufs.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -149,7 +150,7 @@ compare_function(const char *path, const struct stat *st, int flags,
printf("\tsnapshot ");
printf("%s", path);
if (verbose)
printf(" (inode %d)", st->st_ino);
printf(" (inode %ju)", (uintmax_t)st->st_ino);
printf("\n");
if (!cont_search)
return (EEXIST);