aboutsummaryrefslogtreecommitdiff
path: root/sbin/mount_unionfs/mount_unionfs.c
diff options
context:
space:
mode:
authorGarrett Wollman <wollman@FreeBSD.org>1996-05-13 17:43:19 +0000
committerGarrett Wollman <wollman@FreeBSD.org>1996-05-13 17:43:19 +0000
commit5e074e31a22cb630ab1a44da33e64cd3615824ec (patch)
tree45a3a22a6378c4db6229097d19a3e57ef24f2e5c /sbin/mount_unionfs/mount_unionfs.c
parent49968bb8cfacb0f3baa4074609aa24722d51f911 (diff)
downloadsrc-5e074e31a22cb630ab1a44da33e64cd3615824ec.tar.gz
src-5e074e31a22cb630ab1a44da33e64cd3615824ec.zip
Get rid of the last vestiges of the old MOUNT_* constants in the
mount_* programs. While we're at it, collapse the four now-identical mount programs for devfs, fdesc, kernfs, and procfs into links to a new mount_std(8) which can mount any really generic filesystem such as these when called with the appropriate argv[0]. Also, convert the mount programs to use sysexits.h.
Notes
Notes: svn path=/head/; revision=15770
Diffstat (limited to 'sbin/mount_unionfs/mount_unionfs.c')
-rw-r--r--sbin/mount_unionfs/mount_unionfs.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/sbin/mount_unionfs/mount_unionfs.c b/sbin/mount_unionfs/mount_unionfs.c
index 408a6542a1b2..21a0429effd5 100644
--- a/sbin/mount_unionfs/mount_unionfs.c
+++ b/sbin/mount_unionfs/mount_unionfs.c
@@ -53,17 +53,18 @@ static char sccsid[] = "@(#)mount_union.c 8.5 (Berkeley) 3/27/94";
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sysexits.h>
#include <unistd.h>
#include "mntopts.h"
-struct mntopt mopts[] = {
+static struct mntopt mopts[] = {
MOPT_STDOPTS,
{ NULL }
};
-int subdir __P((const char *, const char *));
-void usage __P((void));
+static int subdir __P((const char *, const char *));
+static __dead void usage __P((void)) __dead2;
int
main(argc, argv)
@@ -102,10 +103,10 @@ main(argc, argv)
usage();
if (realpath(argv[0], target) == 0)
- err(1, "%s", target);
+ err(EX_OSERR, "%s", target);
if (subdir(target, argv[1]) || subdir(argv[1], target))
- errx(1, "%s (%s) and %s are not distinct paths",
+ errx(EX_USAGE, "%s (%s) and %s are not distinct paths",
argv[0], target, argv[1]);
args.target = target;
@@ -117,9 +118,11 @@ main(argc, argv)
endvfsent(); /* flush cache */
vfc = getvfsbyname("union");
}
+ if (!vfc)
+ errx(EX_OSERR, "union filesystem is not available");
- if (mount(vfc ? vfc->vfc_index : MOUNT_UNION, argv[1], mntflags, &args))
- err(1, NULL);
+ if (mount(vfc->vfc_index, argv[1], mntflags, &args))
+ err(EX_OSERR, target);
exit(0);
}
@@ -145,5 +148,5 @@ usage()
{
(void)fprintf(stderr,
"usage: mount_union [-br] [-o options] target_fs mount_point\n");
- exit(1);
+ exit(EX_USAGE);
}