summaryrefslogtreecommitdiff
path: root/sbin/mount_ext2fs/mount_ext2fs.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_ext2fs/mount_ext2fs.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_ext2fs/mount_ext2fs.c')
-rw-r--r--sbin/mount_ext2fs/mount_ext2fs.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sbin/mount_ext2fs/mount_ext2fs.c b/sbin/mount_ext2fs/mount_ext2fs.c
index d0d981c95f8..e4e179ecaf1 100644
--- a/sbin/mount_ext2fs/mount_ext2fs.c
+++ b/sbin/mount_ext2fs/mount_ext2fs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mount_ext2fs.c,v 1.11 2003/06/11 06:22:13 deraadt Exp $ */
+/* $OpenBSD: mount_ext2fs.c,v 1.12 2003/07/03 22:41:40 tedu Exp $ */
/* $NetBSD: mount_ffs.c,v 1.3 1996/04/13 01:31:19 jtc Exp $ */
/*-
@@ -40,7 +40,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)mount_ufs.c 8.2 (Berkeley) 3/27/94";
#else
-static char rcsid[] = "$OpenBSD: mount_ext2fs.c,v 1.11 2003/06/11 06:22:13 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: mount_ext2fs.c,v 1.12 2003/07/03 22:41:40 tedu Exp $";
#endif
#endif /* not lint */
@@ -69,7 +69,7 @@ main(int argc, char *argv[])
{
struct ufs_args args; /* XXX ffs_args */
int ch, mntflags;
- char *fs_name, *errcause;
+ char fs_name[MAXPATHLEN], *errcause;
mntflags = 0;
optind = optreset = 1; /* Reset for parse of new argv. */
@@ -89,7 +89,8 @@ main(int argc, char *argv[])
ext2fs_usage();
args.fspec = argv[0]; /* The name of the device file. */
- fs_name = argv[1]; /* The mount point. */
+ if (realpath(argv[1], fs_name) == NULL) /* The mount point. */
+ err(1, "realpath %s", fs_name);
#define DEFAULT_ROOTUID -2
args.export_info.ex_root = DEFAULT_ROOTUID;