diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2014-09-06 04:05:41 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2014-09-06 04:05:41 +0000 |
commit | 1856cb461815dc29ef425f762867e7d638c94235 (patch) | |
tree | c6b3190a4b8c1d9b89e204808492ad4c89e9e14d /sbin/fsck_ffs/setup.c | |
parent | 97a11c5a525f97b0af66d80badd224a9c6271fd2 (diff) |
inodesc.id_entryno holds a file size, so upgrade it from int to u_int64_t;
this fixes handling of very large files on FFS2.
Correct a copy-n-pasto that rendered useless the check for allocated
fragmented that are marked free in the bitmap.
allocdir() returns an inode number, so return an ino_t.
sizeof()*N should be printed with %zu, while direct and indirect block
numbers should be cast to (long long) use %lld
inodesc.id_entryno fix based on a diff from David Vasek <vasek@fido.cz>
ok krw@ otto@
Diffstat (limited to 'sbin/fsck_ffs/setup.c')
-rw-r--r-- | sbin/fsck_ffs/setup.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sbin/fsck_ffs/setup.c b/sbin/fsck_ffs/setup.c index 6c5304ee532..68290caaa5c 100644 --- a/sbin/fsck_ffs/setup.c +++ b/sbin/fsck_ffs/setup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: setup.c,v 1.54 2014/05/29 12:02:50 krw Exp $ */ +/* $OpenBSD: setup.c,v 1.55 2014/09/06 04:05:40 guenther Exp $ */ /* $NetBSD: setup.c,v 1.27 1996/09/27 22:45:19 christos Exp $ */ /* @@ -75,7 +75,8 @@ static const int altsbtry[] = { 32, 64, 128, 144, 160, 192, 256 }; int setup(char *dev) { - long cg, size, asked, i, j, bmapsize; + long cg, size, asked, i, j; + size_t bmapsize; struct disklabel *lp; off_t sizepb; struct stat statb; @@ -382,17 +383,16 @@ found: * allocate and initialize the necessary maps */ bmapsize = roundup(howmany(maxfsblock, NBBY), sizeof(int16_t)); - blockmap = calloc((unsigned)bmapsize, sizeof(char)); + blockmap = calloc(bmapsize, sizeof(char)); if (blockmap == NULL) { - printf("cannot alloc %u bytes for blockmap\n", - (unsigned)bmapsize); + printf("cannot alloc %zu bytes for blockmap\n", bmapsize); goto badsblabel; } inostathead = calloc((unsigned)(sblock.fs_ncg), sizeof(struct inostatlist)); if (inostathead == NULL) { - printf("cannot alloc %u bytes for inostathead\n", - (unsigned)(sizeof(struct inostatlist) * (sblock.fs_ncg))); + printf("cannot alloc %zu bytes for inostathead\n", + (unsigned)sblock.fs_ncg * sizeof(struct inostatlist)); goto badsblabel; } numdirs = MAX(sblock.fs_cstotal.cs_ndir, 128); |