Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/fsck fix logic that handles command line arguments. Now...
details: https://anonhg.NetBSD.org/src/rev/bd9f9b899bf6
branches: trunk
changeset: 333266:bd9f9b899bf6
user: mlelstv <mlelstv%NetBSD.org@localhost>
date: Sat Oct 25 22:00:19 2014 +0000
description:
fix logic that handles command line arguments. Now you can:
fsck /mnt/point
fsck dkX
fsck rdkX
fsck /dev/dkX
fsck /dev/rdkX
fsck NAME=wedge
diffstat:
sbin/fsck/fsck.c | 37 ++++++++++++++++++++++++-------------
1 files changed, 24 insertions(+), 13 deletions(-)
diffs (71 lines):
diff -r 0bb75f1056e3 -r bd9f9b899bf6 sbin/fsck/fsck.c
--- a/sbin/fsck/fsck.c Sat Oct 25 21:11:37 2014 +0000
+++ b/sbin/fsck/fsck.c Sat Oct 25 22:00:19 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fsck.c,v 1.51 2012/04/07 04:52:20 christos Exp $ */
+/* $NetBSD: fsck.c,v 1.52 2014/10/25 22:00:19 mlelstv Exp $ */
/*
* Copyright (c) 1996 Christos Zoulas. All rights reserved.
@@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: fsck.c,v 1.51 2012/04/07 04:52:20 christos Exp $");
+__RCSID("$NetBSD: fsck.c,v 1.52 2014/10/25 22:00:19 mlelstv Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -196,23 +196,30 @@
for (; argc--; argv++) {
- const char *spec, *type, *cp;
+ const char *spec, *spec2, *mntpt, *type, *cp;
char device[MAXPATHLEN];
- spec = *argv;
- cp = strrchr(spec, '/');
+ spec = mntpt = *argv;
+ spec2 = getfsspecname(buf, sizeof(buf), spec);
+ if (spec2 == NULL)
+ spec2 = spec;
+
+ cp = strrchr(spec2, '/');
if (cp == 0) {
(void)snprintf(device, sizeof(device), "%s%s",
- _PATH_DEV, spec);
- spec = device;
+ _PATH_DEV, spec2);
+ spec2 = device;
}
- if ((fs = getfsfile(spec)) == NULL &&
- (fs = getfsspec(spec)) == NULL) {
- if (vfstype == NULL)
- vfstype = getfslab(spec);
- type = vfstype;
+
+ fs = getfsfile(spec);
+ if (fs == NULL)
+ fs = getfsspec(spec);
+ if (fs == NULL && spec != spec2) {
+ fs = getfsspec(spec2);
+ spec = spec2;
}
- else {
+
+ if (fs) {
spec = getfsspecname(buf, sizeof(buf), fs->fs_spec);
if (spec == NULL)
err(FSCK_EXIT_CHECK_FAILED, "%s", buf);
@@ -221,6 +228,10 @@
errx(FSCK_EXIT_CHECK_FAILED,
"%s has unknown file system type.",
spec);
+ } else {
+ if (vfstype == NULL)
+ vfstype = getfslab(spec);
+ type = vfstype;
}
rval = checkfs(type, blockcheck(spec), *argv, NULL, NULL);
Home |
Main Index |
Thread Index |
Old Index