Subject: bin/2361: fsck(_ffs) does not work with filesystem names
To: None <gnats-bugs@NetBSD.ORG>
From: None <greywolf@starwolf.com>
List: netbsd-bugs
Date: 04/29/1996 11:46:42
>Number:         2361
>Category:       bin
>Synopsis:       fsck(_ffs) does not work with filesystem names
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue Apr 30 15:05:08 1996
>Last-Modified:
>Originator:     Greywolf
>Organization:
	Star Wolf Innovations: Food*Beer*Software*Gaming
>Release:        NetBSD-current 960405
>Environment:
	
	SPARCstation 1+
	NetBSD-current 1.1B 4/23/96
	sun4c/fsck_ffs
System: NetBSD strikeforce 1.1B NetBSD 1.1B (STRIKEFORCE) #1: Tue Apr 30 17:25:04 PDT 1996 root@strikeforce:/usr/src/sys/arch/sparc/compile/STRIKEFORCE sparc


>Description:
	fsck_ffs does not work with filesystem names, i.e. "fsck /".
	I have included a patch to "src/sbin/fsck_ffs/preen.c" which
	fixes this by converting the given argument to a filesystem
	special device if necessary.
>How-To-Repeat:
	fsck /
	/ is not a character device
	CONTINUE? [yn]
>Fix:
	Apply the following patch in /usr/src/sbin/fsck_ffs.
--- preen.c	Mon Apr 29 11:37:18 1996
+++ preen.c.orig	Mon Apr 29 11:36:39 1996
@@ -290,6 +290,7 @@
 	char *origname;
 {
 	struct stat stslash, stblock, stchar;
+	struct fstab *fsp;
 	char *newname, *raw;
 	int retried = 0;
 
@@ -330,6 +331,11 @@
 	 * Not a block or character device, just return name and
 	 * let the user decide whether to use it.
 	 */
+	if ((fsp = getfsfile(origname))) {
+	    newname = fsp->fs_spec;
+	    retried++;
+	    goto retry;
+    	}
 	return (origname);
 }
 
>Audit-Trail:
>Unformatted: