NetBSD 1.0 PATCH #2 INDEX DESCRIPTION ----- ----------- patch_02 Fix several serious bugs in fsck(8). Affects: src/sbin/fsck/dir.c src/sbin/fsck/pass2.c diff -c src/sbin/fsck/dir.c:1.7.2.4 src/sbin/fsck/dir.c:1.7.2.5 *** src/sbin/fsck/dir.c:1.7.2.4 Mon Nov 7 14:32:30 1994 --- src/sbin/fsck/dir.c Mon Nov 7 14:32:31 1994 *************** *** 33,39 **** #ifndef lint /*static char sccsid[] = "from: @(#)dir.c 8.1 (Berkeley) 6/5/93";*/ ! static char *rcsid = "$Id: dir.c,v 1.7.2.4 1994/10/06 14:21:51 mycroft Exp $"; #endif /* not lint */ #include --- 33,39 ---- #ifndef lint /*static char sccsid[] = "from: @(#)dir.c 8.1 (Berkeley) 6/5/93";*/ ! static char *rcsid = "$Id: dir.c,v 1.7.2.5 1994/11/07 22:14:29 cgd Exp $"; #endif /* not lint */ #include *************** *** 164,169 **** --- 164,171 ---- dp = (struct direct *)(bp->b_un.b_buf + idesc->id_loc); if (dircheck(idesc, dp)) goto dpok; + if (idesc->id_fix == IGNORE) + return (0); fix = dofix(idesc, "DIRECTORY CORRUPTED"); bp = getdirblk(idesc->id_blkno, blksiz); dp = (struct direct *)(bp->b_un.b_buf + idesc->id_loc); *************** *** 193,198 **** --- 195,202 ---- size = DIRBLKSIZ - (idesc->id_loc % DIRBLKSIZ); idesc->id_loc += size; idesc->id_filesize -= size; + if (idesc->id_fix == IGNORE) + return (0); fix = dofix(idesc, "DIRECTORY CORRUPTED"); bp = getdirblk(idesc->id_blkno, blksiz); dp = (struct direct *)(bp->b_un.b_buf + dploc); diff -c src/sbin/fsck/pass2.c:1.6 src/sbin/fsck/pass2.c:1.6.2.1 *** src/sbin/fsck/pass2.c:1.6 Mon Nov 7 14:32:33 1994 --- src/sbin/fsck/pass2.c Mon Nov 7 14:32:33 1994 *************** *** 33,39 **** #ifndef lint /*static char sccsid[] = "from: @(#)pass2.c 8.2 (Berkeley) 2/27/94";*/ ! static char *rcsid = "$Id: pass2.c,v 1.6 1994/06/08 19:00:27 mycroft Exp $"; #endif /* not lint */ #include --- 33,39 ---- #ifndef lint /*static char sccsid[] = "from: @(#)pass2.c 8.2 (Berkeley) 2/27/94";*/ ! static char *rcsid = "$Id: pass2.c,v 1.6.2.1 1994/11/07 22:14:32 cgd Exp $"; #endif /* not lint */ #include *************** *** 237,242 **** --- 237,251 ---- proto.d_type = 0; proto.d_namlen = 1; (void)strcpy(proto.d_name, "."); + #if BYTE_ORDER == LITTLE_ENDIAN + if (!newinofmt) { + u_char tmp; + + tmp = proto.d_type; + proto.d_type = proto.d_namlen; + proto.d_namlen = tmp; + } + #endif entrysize = DIRSIZ(0, &proto); if (dirp->d_ino != 0 && strcmp(dirp->d_name, "..") != 0) { pfatal("CANNOT FIX, FIRST ENTRY IN DIRECTORY CONTAINS %s\n", *************** *** 271,276 **** --- 280,294 ---- proto.d_type = 0; proto.d_namlen = 2; (void)strcpy(proto.d_name, ".."); + #if BYTE_ORDER == LITTLE_ENDIAN + if (!newinofmt) { + u_char tmp; + + tmp = proto.d_type; + proto.d_type = proto.d_namlen; + proto.d_namlen = tmp; + } + #endif entrysize = DIRSIZ(0, &proto); if (idesc->id_entryno == 0) { n = DIRSIZ(0, dirp); END OF NetBSD 1.0 PATCH #2