diff options
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/fsck_ffs/fsck.h | 3 | ||||
-rw-r--r-- | sbin/fsck_ffs/globs.c | 5 | ||||
-rw-r--r-- | sbin/fsck_ffs/inode.c | 4 | ||||
-rw-r--r-- | sbin/fsck_ffs/setup.c | 9 |
4 files changed, 10 insertions, 11 deletions
diff --git a/sbin/fsck_ffs/fsck.h b/sbin/fsck_ffs/fsck.h index 27f0889..76cbbad 100644 --- a/sbin/fsck_ffs/fsck.h +++ b/sbin/fsck_ffs/fsck.h @@ -282,7 +282,8 @@ struct inoinfo { u_int i_numblks; /* size of block array in bytes */ ufs2_daddr_t i_blks[1]; /* actually longer */ } **inphead, **inpsort; -extern long numdirs, dirhash, listmax, inplast; +extern long dirhash, inplast; +extern unsigned long numdirs, listmax; extern long countdirs; /* number of directories we actually found */ #define MIBSIZE 3 /* size of fsck sysctl MIBs */ diff --git a/sbin/fsck_ffs/globs.c b/sbin/fsck_ffs/globs.c index 35ced61..a642249 100644 --- a/sbin/fsck_ffs/globs.c +++ b/sbin/fsck_ffs/globs.c @@ -56,7 +56,8 @@ struct bufarea sblk; /* file system superblock */ struct bufarea *pdirbp; /* current directory contents */ struct bufarea *pbp; /* current inode block */ ino_t cursnapshot; -long numdirs, dirhash, listmax, inplast; +long dirhash, inplast; +unsigned long numdirs, listmax; long countdirs; /* number of directories we actually found */ int adjrefcnt[MIBSIZE]; /* MIB command to adjust inode reference cnt */ int adjblkcnt[MIBSIZE]; /* MIB command to adjust inode block count */ @@ -123,7 +124,7 @@ fsckinit(void) pdirbp = NULL; pbp = NULL; cursnapshot = 0; - numdirs = dirhash = listmax = inplast = 0; + listmax = numdirs = dirhash = inplast = 0; countdirs = 0; bzero(adjrefcnt, sizeof(int) * MIBSIZE); bzero(adjblkcnt, sizeof(int) * MIBSIZE); diff --git a/sbin/fsck_ffs/inode.c b/sbin/fsck_ffs/inode.c index 0d78814..c72e1be 100644 --- a/sbin/fsck_ffs/inode.c +++ b/sbin/fsck_ffs/inode.c @@ -472,8 +472,8 @@ cacheino(union dinode *dp, ino_t inumber) inp->i_blks[NDADDR + i] = DIP(dp, di_ib[i]); if (inplast == listmax) { listmax += 100; - inpsort = (struct inoinfo **)realloc((char *)inpsort, - (unsigned)listmax * sizeof(struct inoinfo *)); + inpsort = (struct inoinfo **)reallocarray((char *)inpsort, + listmax, sizeof(struct inoinfo *)); if (inpsort == NULL) errx(EEXIT, "cannot increase directory list"); } diff --git a/sbin/fsck_ffs/setup.c b/sbin/fsck_ffs/setup.c index 0bcf06c..5c2b49f 100644 --- a/sbin/fsck_ffs/setup.c +++ b/sbin/fsck_ffs/setup.c @@ -268,8 +268,7 @@ setup(char *dev) (unsigned)bmapsize); goto badsb; } - inostathead = Calloc((unsigned)(sblock.fs_ncg), - sizeof(struct inostatlist)); + inostathead = Calloc(sblock.fs_ncg, sizeof(struct inostatlist)); if (inostathead == NULL) { printf("cannot alloc %u bytes for inostathead\n", (unsigned)(sizeof(struct inostatlist) * (sblock.fs_ncg))); @@ -279,10 +278,8 @@ setup(char *dev) dirhash = numdirs; inplast = 0; listmax = numdirs + 10; - inpsort = (struct inoinfo **)Calloc((unsigned)listmax, - sizeof(struct inoinfo *)); - inphead = (struct inoinfo **)Calloc((unsigned)numdirs, - sizeof(struct inoinfo *)); + inpsort = (struct inoinfo **)Calloc(listmax, sizeof(struct inoinfo *)); + inphead = (struct inoinfo **)Calloc(numdirs, sizeof(struct inoinfo *)); if (inpsort == NULL || inphead == NULL) { printf("cannot alloc %ju bytes for inphead\n", (uintmax_t)numdirs * sizeof(struct inoinfo *)); |