From 6d094b5b76fb6d08a4389dd65717188a11d95b6e Mon Sep 17 00:00:00 2001 From: abs Date: Thu, 22 Apr 1999 04:20:53 +0000 Subject: [PATCH] Copy code across from newfs so that 'fsck sd0a' and similar will work. --- sbin/fsck/fsck.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/sbin/fsck/fsck.c b/sbin/fsck/fsck.c index 92a43e442347..49cbda049e76 100644 --- a/sbin/fsck/fsck.c +++ b/sbin/fsck/fsck.c @@ -1,4 +1,4 @@ -/* $NetBSD: fsck.c,v 1.20 1998/11/12 16:19:48 christos Exp $ */ +/* $NetBSD: fsck.c,v 1.21 1999/04/22 04:20:53 abs Exp $ */ /* * Copyright (c) 1996 Christos Zoulas. All rights reserved. @@ -40,7 +40,7 @@ #include #ifndef lint -__RCSID("$NetBSD: fsck.c,v 1.20 1998/11/12 16:19:48 christos Exp $"); +__RCSID("$NetBSD: fsck.c,v 1.21 1999/04/22 04:20:53 abs Exp $"); #endif /* not lint */ #include @@ -56,6 +56,7 @@ __RCSID("$NetBSD: fsck.c,v 1.20 1998/11/12 16:19:48 christos Exp $"); #include #include #include +#include #include #include #include @@ -165,13 +166,20 @@ main(argc, argv) for (; argc--; argv++) { - const char *spec, *type; + const char *spec, *type, *cp; + char device[MAXPATHLEN]; - if ((fs = getfsfile(*argv)) == NULL && - (fs = getfsspec(*argv)) == NULL) { + spec = *argv; + cp = strrchr(spec, '/'); + if (cp == 0) { + (void)snprintf(device, sizeof(device), "%s%s", + _PATH_DEV, spec); + spec = device; + } + if ((fs = getfsfile(spec)) == NULL && + (fs = getfsspec(spec)) == NULL) { if (vfstype == NULL) - vfstype = getfslab(*argv); - spec = *argv; + vfstype = getfslab(spec); type = vfstype; } else { @@ -179,7 +187,7 @@ main(argc, argv) type = fs->fs_vfstype; if (BADTYPE(fs->fs_type)) errx(1, "%s has unknown file system type.", - *argv); + spec); } rval |= checkfs(type, blockcheck(spec), *argv, NULL, NULL);