summaryrefslogtreecommitdiff
path: root/sbin/mount_procfs/mount_procfs.c
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2003-07-03 22:41:41 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2003-07-03 22:41:41 +0000
commit68c4ff61328d01e604a97f41a255784b3ba007b2 (patch)
tree7424873456d7982920c124a4f0a56cb7140ca8c8 /sbin/mount_procfs/mount_procfs.c
parentf231113e2426ef83d1f4662298c597f2d2719ed5 (diff)
use realpath() in helpers instead of doing it ourselves every time.
also fixes pr1662. from otto moerbeek
Diffstat (limited to 'sbin/mount_procfs/mount_procfs.c')
-rw-r--r--sbin/mount_procfs/mount_procfs.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sbin/mount_procfs/mount_procfs.c b/sbin/mount_procfs/mount_procfs.c
index 77f4791aa2d..e36debd92f9 100644
--- a/sbin/mount_procfs/mount_procfs.c
+++ b/sbin/mount_procfs/mount_procfs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mount_procfs.c,v 1.10 2003/06/11 06:22:14 deraadt Exp $ */
+/* $OpenBSD: mount_procfs.c,v 1.11 2003/07/03 22:41:40 tedu Exp $ */
/* $NetBSD: mount_procfs.c,v 1.7 1996/04/13 01:31:59 jtc Exp $ */
/*
@@ -44,7 +44,7 @@ char copyright[] =
#if 0
static char sccsid[] = "@(#)mount_procfs.c 8.3 (Berkeley) 3/27/94";
#else
-static char rcsid[] = "$OpenBSD: mount_procfs.c,v 1.10 2003/06/11 06:22:14 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: mount_procfs.c,v 1.11 2003/07/03 22:41:40 tedu Exp $";
#endif
#endif /* not lint */
@@ -75,6 +75,7 @@ main(int argc, char *argv[])
{
int ch, mntflags, altflags;
struct procfs_args args;
+ char path[MAXPATHLEN];
mntflags = altflags = 0;
while ((ch = getopt(argc, argv, "o:")) != -1)
@@ -92,10 +93,13 @@ main(int argc, char *argv[])
if (argc != 2)
usage();
+ if (realpath(argv[1], path) == NULL)
+ err(1, "realpath %s", path);
+
args.version = PROCFS_ARGSVERSION;
args.flags = altflags;
- if (mount(MOUNT_PROCFS, argv[1], mntflags, &args)) {
+ if (mount(MOUNT_PROCFS, path, mntflags, &args)) {
if (errno == EOPNOTSUPP)
errx(1, "%s: Filesystem not supported by kernel",
argv[1]);