From owner-freebsd-current Fri Nov 22 21:45:56 1996 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id VAA10942 for current-outgoing; Fri, 22 Nov 1996 21:45:56 -0800 (PST) Received: from nike.efn.org (resnet.uoregon.edu [128.223.170.28]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id VAA10934 for ; Fri, 22 Nov 1996 21:45:44 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by nike.efn.org (8.8.3/8.8.3) with SMTP id TAA17750 for ; Fri, 22 Nov 1996 19:03:47 -0800 (PST) Date: Fri, 22 Nov 1996 19:03:47 -0800 (PST) From: John-Mark Gurney X-Sender: jmg@nike Reply-To: John-Mark Gurney To: FreeBSD Current Subject: my fsck patch (revision 1.4 of src/sbin/fsck/preen.c) Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-current@freebsd.org X-Loop: FreeBSD.org Precedence: bulk I just relized that there is a time that this will fail to operate like it was suppose to... say you have a /etc/fstab like: /dev/sd0a / ufs rw 1 1 /dev/sd0s1f /usr ufs rw 1 2 /dev/cd2a /usr/anon/pub/cdrom2 cd9660 ro,noauto 0 0 but the cdrom was a ufs file system.... you boot single user mode and try: fsck /usr/anon/pub/cdrom2 fsck won't resolve it because the patch expects it to return a directory... most chances are you won't have a /usr/anon/pub/cdrom2 on your /... it's probably in /usr... (I know this may be bas fs design but it's possible)... so I was thinking something like this patch: Index: preen.c =================================================================== RCS file: /usr/cvs/src/sbin/fsck/preen.c,v retrieving revision 1.5 diff -c -r1.5 preen.c *** preen.c 1996/10/27 18:28:39 1.5 --- preen.c 1996/11/23 02:58:07 *************** *** 304,312 **** } retry: if (stat(name, &stblock) < 0) { ! perror(name); ! printf("Can't stat %s\n", name); ! return (0); } if ((stblock.st_mode & S_IFMT) == S_IFBLK) { if (stslash.st_dev == stblock.st_rdev) --- 304,310 ---- } retry: if (stat(name, &stblock) < 0) { ! goto trydir; } if ((stblock.st_mode & S_IFMT) == S_IFBLK) { if (stslash.st_dev == stblock.st_rdev) *************** *** 328,333 **** --- 326,332 ---- retried++; goto retry; } else if ((stblock.st_mode & S_IFMT) == S_IFDIR && !retried) { + trydir: l = strlen(name) - 1; if (l > 0 && name[l] == '/') /* remove trailing slash */ the other way would be to duplicate the code (which I would prefere)... I detest goto :)... but there is already goto used in this function... so I'm not as leary about using it... thanks for your ideas... ttyl.. John-Mark gurney_j@efn.org http://resnet.uoregon.edu/~gurney_j/ Modem/FAX: (541) 683-6954 (FreeBSD Box) Live in Peace, destroy Micro$oft, support free software, run FreeBSD (unix)