gww@beatnix.UUCP (Gary Winiger) (03/13/88)
Subject: Fsck aborts when building the path name. +Fix Index: etc/fsck/dir.c 4.3BSD +Fix Description: Fsck gets an segmentation fault when trying to build the path name. Repeat-By: On a system that does not permit dereferencing of null pointers, be unlucky enough to get file system damage on your root file system. Have a heart attack, root won't fsck because fsck takes a dump. Can't boot, or fsck even in single user (in our case fixed it by going back to the 4.2 fsck). Have fsck try to reconnect a file when there is a valid lost+found. When it tries to build the path name after making the entry in lost+found, it will try to bcopy from a null pointer. Fix: It appears that the code was left over from a previous life. The variable ``len'' is set to the length of ``tempname'', and the pathname is incremented by ``len'', but the name being copied to the path name is null or lost+found again, if a new lost+found was just made. The attached code solves this problem at Elxsi. Gary.. {ucbvax!sun,lll-lcc!lll-tis,amdahl!altos86,bridge2}!elxsi!gww --------- cut --------- snip --------- :.,$w diff ------------- *** /tmp/,RCSt1000385 Mon Sep 28 17:36:05 1987 --- dir.c Mon Sep 28 17:35:37 1987 *************** *** 1,5 **** --- 1,8 ---- /* * $Log: dir.c,v $ + * Revision 1.2 87/09/28 17:34:43 gww + * Correct name being accumulated for path being fixed. + * * Revision 1.1 87/04/01 15:08:17 gww * Initial revision * *************** *** 11,17 **** */ #ifndef lint ! static char *ERcsId = "$Header: dir.c,v 1.1 87/04/01 15:08:17 gww Exp $ ENIX BSD"; static char sccsid[] = "@(#)dir.c 5.1 (Berkeley) 6/5/85"; #endif not lint --- 14,20 ---- */ #ifndef lint ! static char *ERcsId = "$Header: dir.c,v 1.2 87/09/28 17:34:43 gww Exp $ ENIX BSD"; static char sccsid[] = "@(#)dir.c 5.1 (Berkeley) 6/5/85"; #endif not lint *************** *** 381,387 **** } lncntp[orphan]--; *pathp++ = '/'; ! bcopy(idesc.id_name, pathp, len + 1); pathp += len; if (lostdir) { dp = ginode(orphan); --- 384,390 ---- } lncntp[orphan]--; *pathp++ = '/'; ! bcopy(tempname, pathp, len + 1); pathp += len; if (lostdir) { dp = ginode(orphan);