gww@marduk.UUCP (Gary Winiger) (09/05/87)
Subject: Restore will get a segmentation violation in interactive mode +Fix Index: etc/restore/interactive.c 4.3BSD +Fix Description: When running /etc/restore in interactive mode, any attempt to reference a subdirectory will cause a segmentation violation on systems that do not permit dereferencing a NULL pointer. Repeat-By: On a system that does not permit dereferencing a NULL pointer: Make a dump tape from a file system with subdirectories. /etc/restore if <tape> restore > cd <subdirectory> Catch core dump before it hits the floor. Fix: In expandarg() test if lookupname has returned NIL. If so, set the inode number to zero. The attached code solves this problem at Elxsi. Gary.. {ucbvax!sun,lll-lcc!lll-tis,amdahl!amdahl!altos86,bridge2}!elxsi!gww --------- cut --------- snip --------- :.,$w diff ------------- *** /tmp/,RCSt1000905 Fri Jul 24 14:01:00 1987 --- interactive.c Fri Jul 24 14:00:36 1987 *************** *** 1,5 **** --- 1,8 ---- /* * $Log: interactive.c,v $ + * Revision 1.2 87/07/24 14:00:13 gww + * Don't dereference a NULL pointer. + * * Revision 1.1 87/04/01 13:33:28 gww * Initial revision * *************** *** 11,17 **** */ #ifndef lint ! static char *ERcsId = "$Header: interactive.c,v 1.1 87/04/01 13:33:28 gww Exp $ ENIX BSD"; static char sccsid[] = "@(#)interactive.c 5.3 (Berkeley) 7/21/85"; #endif not lint --- 14,20 ---- */ #ifndef lint ! static char *ERcsId = "$Header: interactive.c,v 1.2 87/07/24 14:00:13 gww Exp $ ENIX BSD"; static char sccsid[] = "@(#)interactive.c 5.3 (Berkeley) 7/21/85"; #endif not lint *************** *** 405,416 **** register struct arglist *ap; { static struct afile single; int size; ap->head = ap->last = (struct afile *)0; size = expand(arg, 0, ap); if (size == 0) { ! single.fnum = lookupname(arg)->e_ino; single.fname = savename(arg); ap->head = &single; ap->last = ap->head + 1; --- 408,421 ---- register struct arglist *ap; { static struct afile single; + struct entry *ep; int size; ap->head = ap->last = (struct afile *)0; size = expand(arg, 0, ap); if (size == 0) { ! ep = lookupname(arg); ! single.fnum = ep != NIL ? ep->e_ino : 0; single.fname = savename(arg); ap->head = &single; ap->last = ap->head + 1;