X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/a2b718781ce47ae637e50d0cdc61e59a91a907ef..94cf96fde7c78a95aa79a403aa093bffb3504b59:/usr/src/sbin/fsck/dir.c diff --git a/usr/src/sbin/fsck/dir.c b/usr/src/sbin/fsck/dir.c index 3943f4ba52..1500365cd1 100644 --- a/usr/src/sbin/fsck/dir.c +++ b/usr/src/sbin/fsck/dir.c @@ -6,7 +6,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)dir.c 5.22 (Berkeley) %G%"; +static char sccsid[] = "@(#)dir.c 5.24 (Berkeley) %G%"; #endif /* not lint */ #include @@ -137,8 +137,6 @@ fsck_readdir(idesc) dp = (struct direct *)(bp->b_un.b_buf + idesc->id_loc); if (dircheck(idesc, dp)) 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); @@ -149,6 +147,8 @@ fsck_readdir(idesc) dp->d_name[0] = '\0'; if (fix) dirty(bp); + idesc->id_loc += DIRBLKSIZ; + idesc->id_filesize -= DIRBLKSIZ; return (dp); } dpok: @@ -304,6 +304,8 @@ mkentry(idesc) dirp->d_ino = idesc->id_parent; /* ino to be entered is in id_parent */ if (newinofmt) dirp->d_type = typemap[idesc->id_parent]; + else + dirp->d_type = 0; dirp->d_reclen = newent.d_reclen; dirp->d_namlen = newent.d_namlen; bcopy(idesc->id_name, dirp->d_name, (size_t)dirp->d_namlen + 1); @@ -320,6 +322,8 @@ chgino(idesc) dirp->d_ino = idesc->id_parent; if (newinofmt) dirp->d_type = typemap[idesc->id_parent]; + else + dirp->d_type = 0; return (ALTERED|STOP); }