summaryrefslogtreecommitdiff
path: root/sbin/fsck_ffs/main.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2015-10-14 14:33:46 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2015-10-14 14:33:46 +0000
commite9e3890d5f6f8ad7e6418d99a04881cd69e43fed (patch)
tree3876c2f4ed3925569b3c203e779c7b64c326cdee /sbin/fsck_ffs/main.c
parent71e350f4c80a88e567c8186bf97f751f6460b22c (diff)
Only accept one filesystem/device as argument for checking. Few people
will be calling these directly, and not for the multiple filesystem case. fsck(8) is generally the parent and will handle things. ok semarie; this change will also help a goal jsing has
Diffstat (limited to 'sbin/fsck_ffs/main.c')
-rw-r--r--sbin/fsck_ffs/main.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/sbin/fsck_ffs/main.c b/sbin/fsck_ffs/main.c
index 63bd1feeea2..611da7fb61c 100644
--- a/sbin/fsck_ffs/main.c
+++ b/sbin/fsck_ffs/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.44 2015/02/07 02:09:13 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.45 2015/10/14 14:33:45 deraadt Exp $ */
/* $NetBSD: main.c,v 1.22 1996/10/11 20:15:48 thorpej Exp $ */
/*
@@ -53,6 +53,13 @@ int main(int, char *[]);
extern char *__progname;
+void
+usage(void)
+{
+ fprintf(stderr, "usage: %s [-fnpy] [-b block#] [-c level] "
+ "[-m mode] filesystem\n", __progname);
+ exit(1);
+}
int
main(int argc, char *argv[])
{
@@ -109,21 +116,22 @@ main(int argc, char *argv[])
break;
default:
- errexit("usage: %s [-fnpy] [-b block#] [-c level] "
- "[-m mode] filesystem ...\n", __progname);
+ usage();
}
}
argc -= optind;
argv += optind;
+
+ if (argc != 1)
+ usage();
+
if (signal(SIGINT, SIG_IGN) != SIG_IGN)
(void)signal(SIGINT, catch);
if (preen)
(void)signal(SIGQUIT, catchquit);
(void)signal(SIGINFO, catchinfo);
- if (argc)
- while (argc-- > 0)
- (void)checkfilesys(blockcheck(*argv++), 0, 0L, 0);
+ (void)checkfilesys(blockcheck(*argv), 0, 0L, 0);
if (returntosingle)
ret = 2;