aboutsummaryrefslogtreecommitdiff
path: root/sbin/mount_cd9660/mount_cd9660.c
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/mount_cd9660/mount_cd9660.c')
-rw-r--r--sbin/mount_cd9660/mount_cd9660.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sbin/mount_cd9660/mount_cd9660.c b/sbin/mount_cd9660/mount_cd9660.c
index a3185d7f9f3c..665d22f64787 100644
--- a/sbin/mount_cd9660/mount_cd9660.c
+++ b/sbin/mount_cd9660/mount_cd9660.c
@@ -85,7 +85,7 @@ main(int argc, char **argv)
{
struct iso_args args;
int ch, mntflags, opts;
- char *dev, *dir;
+ char *dev, *dir, mntpath[MAXPATHLEN];
struct vfsconf vfc;
int error, verbose;
@@ -128,6 +128,13 @@ main(int argc, char **argv)
dev = argv[0];
dir = argv[1];
+ /*
+ * Resolve the mountpoint with realpath(3) and remove unnecessary
+ * slashes from the devicename if there are any.
+ */
+ (void)checkpath(dir, mntpath);
+ (void)rmslashes(dev, dev);
+
#define DEFAULT_ROOTUID -2
/*
* ISO 9660 filesystems are not writeable.
@@ -168,7 +175,7 @@ main(int argc, char **argv)
if (error)
errx(1, "cd9660 filesystem is not available");
- if (mount(vfc.vfc_name, dir, mntflags, &args) < 0)
+ if (mount(vfc.vfc_name, mntpath, mntflags, &args) < 0)
err(1, NULL);
exit(0);
}