aboutsummaryrefslogtreecommitdiff
path: root/sbin/mount_ext2fs
diff options
context:
space:
mode:
authorPoul-Henning Kamp <phk@FreeBSD.org>1999-10-09 11:54:14 +0000
committerPoul-Henning Kamp <phk@FreeBSD.org>1999-10-09 11:54:14 +0000
commit73dd3167345391095dd7c75aefa870a5bce92397 (patch)
tree33cadf04c808cb0644aedaa306f8f3c0987ba3fe /sbin/mount_ext2fs
parent1d64c295bbdb773ca3d62cdb5a9eec06e12799c8 (diff)
downloadsrc-73dd3167345391095dd7c75aefa870a5bce92397.tar.gz
src-73dd3167345391095dd7c75aefa870a5bce92397.zip
Notes
Diffstat (limited to 'sbin/mount_ext2fs')
-rw-r--r--sbin/mount_ext2fs/mount_ext2fs.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sbin/mount_ext2fs/mount_ext2fs.c b/sbin/mount_ext2fs/mount_ext2fs.c
index 00a20246f499..ded01952a936 100644
--- a/sbin/mount_ext2fs/mount_ext2fs.c
+++ b/sbin/mount_ext2fs/mount_ext2fs.c
@@ -76,7 +76,7 @@ main(argc, argv)
{
struct ufs_args args;
int ch, mntflags;
- char *fs_name, *options;
+ char *fs_name, *options, mntpath[MAXPATHLEN];
struct vfsconf vfc;
int error;
@@ -100,6 +100,13 @@ main(argc, argv)
args.fspec = argv[0]; /* the name of the device file */
fs_name = argv[1]; /* the mount point */
+ /*
+ * Resolve the mountpoint with realpath(3) and remove unnecessary
+ * slashes from the devicename if there are any.
+ */
+ (void)checkpath(fs_name, mntpath);
+ (void)rmslashes(args.fspec, args.fspec);
+
#define DEFAULT_ROOTUID -2
args.export.ex_root = DEFAULT_ROOTUID;
if (mntflags & MNT_RDONLY)
@@ -118,7 +125,7 @@ main(argc, argv)
if (error)
errx(EX_OSERR, "ext2fs filesystem is not available");
- if (mount(vfc.vfc_name, fs_name, mntflags, &args) < 0)
+ if (mount(vfc.vfc_name, mntpath, mntflags, &args) < 0)
err(EX_OSERR, "%s", args.fspec);
exit(0);
}