must apply beginning of directory check at each resync point (Tom Lyons)
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Tue, 24 Jan 1984 06:56:45 +0000 (22:56 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Tue, 24 Jan 1984 06:56:45 +0000 (22:56 -0800)
SCCS-vsn: sbin/fsck/main.c 2.31

usr/src/sbin/fsck/main.c

index 3717037..f370a3d 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-char version[] = "@(#)main.c   2.30 (Berkeley) %G%";
+char version[] = "@(#)main.c   2.31 (Berkeley) %G%";
 #endif
 
 #include <stdio.h>
 #endif
 
 #include <stdio.h>
@@ -1509,10 +1509,11 @@ dpok:
        dp = (DIRECT *)(dirblk.b_buf + idesc->id_loc);
        idesc->id_loc += dp->d_reclen;
        idesc->id_filesize -= dp->d_reclen;
        dp = (DIRECT *)(dirblk.b_buf + idesc->id_loc);
        idesc->id_loc += dp->d_reclen;
        idesc->id_filesize -= dp->d_reclen;
+       if ((idesc->id_loc % DIRBLKSIZ) == 0)
+               return (dp);
        ndp = (DIRECT *)(dirblk.b_buf + idesc->id_loc);
        ndp = (DIRECT *)(dirblk.b_buf + idesc->id_loc);
-       if ((idesc->id_filesize <= 0 && idesc->id_loc % DIRBLKSIZ != 0) ||
-           (idesc->id_loc < blksiz && idesc->id_filesize > 0 &&
-            dircheck(idesc, ndp) == 0)) {
+       if (idesc->id_loc < blksiz && idesc->id_filesize > 0 &&
+           dircheck(idesc, ndp) == 0) {
                size = DIRBLKSIZ - (idesc->id_loc % DIRBLKSIZ);
                dp->d_reclen += size;
                idesc->id_loc += size;
                size = DIRBLKSIZ - (idesc->id_loc % DIRBLKSIZ);
                dp->d_reclen += size;
                idesc->id_loc += size;