From 00552f61785b5f751008e2899182e73541af1b20 Mon Sep 17 00:00:00 2001 From: "Michael I. Bushnell" Date: Tue, 18 Oct 1994 00:33:04 +0000 Subject: Formerly dir.c.~6~ --- ufs-fsck/dir.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/ufs-fsck/dir.c b/ufs-fsck/dir.c index b1061587..0a0c0ac2 100644 --- a/ufs-fsck/dir.c +++ b/ufs-fsck/dir.c @@ -37,7 +37,7 @@ record_directory (struct dinode *dp, ino_t number) dnp->i_number = number; dnp->i_parent = dnp->i_dotdot = 0; - dnp->i_isize = dnp->i_isize; + dnp->i_isize = dp->di_size; dnp->i_numblks = blks * sizeof (daddr_t); bcopy (dp->di_db, dnp->i_blks, blks); @@ -129,14 +129,15 @@ searchdir (ino_t dir, char *name, ino_t *ino) NAME. Return 1 if we should keep looking at more blocks. */ int - checkdirblock (daddr_t bno, int nfrags) + checkdirblock (daddr_t bno, int nfrags, off_t offset) { void *buf = alloca (nfrags * sblock->fs_fsize); void *bufp; readblock (fsbtodb (sblock, bno), buf, nfrags * sblock->fs_fsize); for (bufp = buf; - bufp - buf < nfrags * sblock->fs_fsize; + bufp - buf < nfrags * sblock->fs_fsize + && offset + (bufp - buf) + DIRBLKSIZ <= dino.di_size; bufp += DIRBLKSIZ) { check1block (bufp); @@ -199,14 +200,15 @@ changeino (ino_t dir, char *name, ino_t ino) contains NAME. Return 1 if we should keep looking at more blocks. */ int - checkdirblock (daddr_t bno, int nfrags) + checkdirblock (daddr_t bno, int nfrags, off_t offset) { void *buf = alloca (nfrags * sblock->fs_fsize); void *bufp; readblock (fsbtodb (sblock, bno), buf, nfrags * sblock->fs_fsize); for (bufp = buf; - bufp - buf < nfrags * sblock->fs_fsize; + bufp - buf < nfrags * sblock->fs_fsize + && offset + (bufp - buf) + DIRBLKSIZ <= dino.di_size; bufp += DIRBLKSIZ) { if (check1block (bufp)) @@ -328,14 +330,15 @@ makeentry (ino_t dir, ino_t ino, char *name) contains NAME. Return 1 if we should keep looking at more blocks. */ int - checkdirblock (daddr_t bno, int nfrags) + checkdirblock (daddr_t bno, int nfrags, off_t offset) { void *buf = alloca (nfrags * sblock->fs_fsize); void *bufp; readblock (fsbtodb (sblock, bno), buf, nfrags * sblock->fs_fsize); for (bufp = buf; - bufp - buf < nfrags * sblock->fs_fsize; + bufp - buf < nfrags * sblock->fs_fsize + && offset + (bufp - buf) + DIRBLKSIZ <= dino.di_size; bufp += DIRBLKSIZ) { if (check1block (bufp)) -- cgit v1.2.3