summaryrefslogtreecommitdiffstats
path: root/sbin/fsck
diff options
context:
space:
mode:
authorsobomax <sobomax@FreeBSD.org>2011-10-25 01:46:42 +0000
committersobomax <sobomax@FreeBSD.org>2011-10-25 01:46:42 +0000
commite1f2c1df247d1210f90b4261ae7b44f3882e2d55 (patch)
tree0b2d12855f26b47e45ee0c1904148061be1eb36a /sbin/fsck
parent9ae130094e47bb0d823a87f3a50fa4915fcd00a1 (diff)
downloadFreeBSD-src-e1f2c1df247d1210f90b4261ae7b44f3882e2d55.zip
FreeBSD-src-e1f2c1df247d1210f90b4261ae7b44f3882e2d55.tar.gz
Add new option -c to specify alternatve location of the /etc/fstab
file. MFC after: 1 month
Diffstat (limited to 'sbin/fsck')
-rw-r--r--sbin/fsck/fsck.85
-rw-r--r--sbin/fsck/fsck.c13
2 files changed, 16 insertions, 2 deletions
diff --git a/sbin/fsck/fsck.8 b/sbin/fsck/fsck.8
index d3f1d4a..3fa113a 100644
--- a/sbin/fsck/fsck.8
+++ b/sbin/fsck/fsck.8
@@ -41,6 +41,7 @@
.Op Fl B | F
.Op Fl T Ar fstype : Ns Ar fsoptions
.Op Fl t Ar fstype
+.Op Fl c Ar fstab
.Oo Ar special | node Oc ...
.Sh DESCRIPTION
The
@@ -117,6 +118,10 @@ Check if the
.Dq clean
flag is set in the superblock and skip file system checks if file system was
properly dismounted and marked clean.
+.It Fl c Ar fstab
+Specify the
+.Pa fstab
+file to use.
.It Fl d
Debugging mode.
Just print the commands without executing them.
diff --git a/sbin/fsck/fsck.c b/sbin/fsck/fsck.c
index 24c4e13..5e27010 100644
--- a/sbin/fsck/fsck.c
+++ b/sbin/fsck/fsck.c
@@ -96,6 +96,7 @@ main(int argc, char *argv[])
int i, rval = 0;
const char *vfstype = NULL;
char globopt[3];
+ const char *etc_fstab;
globopt[0] = '-';
globopt[2] = '\0';
@@ -103,7 +104,8 @@ main(int argc, char *argv[])
TAILQ_INIT(&selhead);
TAILQ_INIT(&opthead);
- while ((i = getopt(argc, argv, "BCdvpfFnyl:t:T:")) != -1)
+ etc_fstab = NULL;
+ while ((i = getopt(argc, argv, "BCdvpfFnyl:t:T:c:")) != -1)
switch (i) {
case 'B':
if (flags & CHECK_BACKGRD)
@@ -160,6 +162,10 @@ main(int argc, char *argv[])
vfstype = optarg;
break;
+ case 'c':
+ etc_fstab = optarg;
+ break;
+
case '?':
default:
usage();
@@ -169,6 +175,9 @@ main(int argc, char *argv[])
argc -= optind;
argv += optind;
+ if (etc_fstab != NULL)
+ setfstab(etc_fstab);
+
if (argc == 0)
return checkfstab(flags, isok, checkfs);
@@ -571,7 +580,7 @@ static void
usage(void)
{
static const char common[] =
- "[-Cdfnpvy] [-B | -F] [-T fstype:fsoptions] [-t fstype]";
+ "[-Cdfnpvy] [-B | -F] [-T fstype:fsoptions] [-t fstype] [-c fstab]";
(void)fprintf(stderr, "usage: %s %s [special | node] ...\n",
getprogname(), common);
OpenPOWER on IntegriCloud