SCCS-vsn: sbin/fsck/dir.c 5.13
-static char sccsid[] = "@(#)dir.c 5.12 (Berkeley) %G%";
+static char sccsid[] = "@(#)dir.c 5.13 (Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
idesc->id_dirp = (struct direct *)dbuf;
if ((n = (*idesc->id_func)(idesc)) & ALTERED) {
bp = getdirblk(idesc->id_blkno, blksiz);
idesc->id_dirp = (struct direct *)dbuf;
if ((n = (*idesc->id_func)(idesc)) & ALTERED) {
bp = getdirblk(idesc->id_blkno, blksiz);
- bcopy(dbuf, (char *)dp, dsize);
+ bcopy(dbuf, bp->b_un.b_buf + idesc->id_loc - dsize,
+ dsize);
{
register struct direct *dp, *ndp;
register struct bufarea *bp;
{
register struct direct *dp, *ndp;
register struct bufarea *bp;
+ long size, blksiz, fix;
blksiz = idesc->id_numfrags * sblock.fs_fsize;
bp = getdirblk(idesc->id_blkno, blksiz);
blksiz = idesc->id_numfrags * sblock.fs_fsize;
bp = getdirblk(idesc->id_blkno, blksiz);
goto dpok;
idesc->id_loc += DIRBLKSIZ;
idesc->id_filesize -= DIRBLKSIZ;
goto dpok;
idesc->id_loc += DIRBLKSIZ;
idesc->id_filesize -= DIRBLKSIZ;
+ fix = dofix(idesc, "DIRECTORY CORRUPTED");
+ bp = getdirblk(idesc->id_blkno, blksiz);
+ dp = (struct direct *)(bp->b_un.b_buf + idesc->id_loc);
dp->d_reclen = DIRBLKSIZ;
dp->d_ino = 0;
dp->d_namlen = 0;
dp->d_name[0] = '\0';
dp->d_reclen = DIRBLKSIZ;
dp->d_ino = 0;
dp->d_namlen = 0;
dp->d_name[0] = '\0';
- if (dofix(idesc, "DIRECTORY CORRUPTED"))
dirty(bp);
return (dp);
}
dirty(bp);
return (dp);
}
if (idesc->id_loc < blksiz && idesc->id_filesize > 0 &&
dircheck(idesc, ndp) == 0) {
size = DIRBLKSIZ - (idesc->id_loc % DIRBLKSIZ);
if (idesc->id_loc < blksiz && idesc->id_filesize > 0 &&
dircheck(idesc, ndp) == 0) {
size = DIRBLKSIZ - (idesc->id_loc % DIRBLKSIZ);
idesc->id_loc += size;
idesc->id_filesize -= size;
idesc->id_loc += size;
idesc->id_filesize -= size;
- if (dofix(idesc, "DIRECTORY CORRUPTED"))
+ fix = dofix(idesc, "DIRECTORY CORRUPTED");
+ bp = getdirblk(idesc->id_blkno, blksiz);
+ dp = (struct direct *)(bp->b_un.b_buf + idesc->id_loc);
+ dp->d_reclen += size;
+ if (fix)
dirty(bp);
}
return (dp);
dirty(bp);
}
return (dp);