From 68c4ff61328d01e604a97f41a255784b3ba007b2 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Thu, 3 Jul 2003 22:41:41 +0000 Subject: use realpath() in helpers instead of doing it ourselves every time. also fixes pr1662. from otto moerbeek --- sbin/mount_ext2fs/mount_ext2fs.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'sbin/mount_ext2fs/mount_ext2fs.c') 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; -- cgit v1.2.3