summaryrefslogtreecommitdiffstats
path: root/sbin/mount_ntfs/mount_ntfs.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1999-10-09 11:54:14 +0000
committerphk <phk@FreeBSD.org>1999-10-09 11:54:14 +0000
commit41c4f3920e76ddd3b3a183fc18e6e0834a26086b (patch)
tree90d36f2866e2e9c8c9fe890230d8240ed54253f1 /sbin/mount_ntfs/mount_ntfs.c
parent977cb3153eec3286210df53421e8494748c21d3a (diff)
downloadFreeBSD-src-41c4f3920e76ddd3b3a183fc18e6e0834a26086b.zip
FreeBSD-src-41c4f3920e76ddd3b3a183fc18e6e0834a26086b.tar.gz
mount* fixes from Martin Blapp <mb@imp.ch>:
Made mount more userfriendly (bad slashes are now filtered out) and we remove in mount_nfs trailing slashes if there are any. Fixed mount_xxx binarys to resolve with realpath(3) the mountpoint. Translate the deprecated nfs-syntax with '@' to ':' . The ':' syntax has now precedence, but '@' still works. Notify the user that the '@' syntax should not be used. PR: 7846 PR: 13692 Submitted by: Martin Blapp <mb@imp.ch> Reviewed by: phk
Diffstat (limited to 'sbin/mount_ntfs/mount_ntfs.c')
-rw-r--r--sbin/mount_ntfs/mount_ntfs.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/sbin/mount_ntfs/mount_ntfs.c b/sbin/mount_ntfs/mount_ntfs.c
index add62a1..95b86c2 100644
--- a/sbin/mount_ntfs/mount_ntfs.c
+++ b/sbin/mount_ntfs/mount_ntfs.c
@@ -67,8 +67,8 @@ main(argc, argv)
{
struct ntfs_args args;
struct stat sb;
- int c, mntflags, set_gid, set_uid, set_mask,error;
- char *dev, *dir, ndir[MAXPATHLEN+1];
+ int c, mntflags, set_gid, set_uid, set_mask, error;
+ char *dev, *dir, ndir[MAXPATHLEN+1], mntpath[MAXPATHLEN];
#if __FreeBSD_version >= 300000
struct vfsconf vfc;
#else
@@ -113,15 +113,13 @@ main(argc, argv)
dev = argv[optind];
dir = argv[optind + 1];
- if (dir[0] != '/') {
- warnx("\"%s\" is a relative path", dir);
- if (getcwd(ndir, sizeof(ndir)) == NULL)
- err(EX_OSERR, "getcwd");
- strncat(ndir, "/", sizeof(ndir) - strlen(ndir) - 1);
- strncat(ndir, dir, sizeof(ndir) - strlen(ndir) - 1);
- dir = ndir;
- warnx("using \"%s\" instead", dir);
- }
+
+ /*
+ * 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);
args.fspec = dev;
args.export.ex_root = 65534; /* unchecked anyway on DOS fs */
@@ -130,8 +128,8 @@ main(argc, argv)
else
args.export.ex_flags = 0;
if (!set_gid || !set_uid || !set_mask) {
- if (stat(dir, &sb) == -1)
- err(EX_OSERR, "stat %s", dir);
+ if (stat(mntpath, &sb) == -1)
+ err(EX_OSERR, "stat %s", mntpath);
if (!set_uid)
args.uid = sb.st_uid;
@@ -166,9 +164,9 @@ main(argc, argv)
errx(EX_OSERR, "ntfs filesystem is not available");
#if __FreeBSD_version >= 300000
- if (mount(vfc.vfc_name, dir, mntflags, &args) < 0)
+ if (mount(vfc.vfc_name, mntpath, mntflags, &args) < 0)
#else
- if (mount(vfc->vfc_index, dir, mntflags, &args) < 0)
+ if (mount(vfc->vfc_index, mntpath, mntflags, &args) < 0)
#endif
err(EX_OSERR, "%s", dev);
OpenPOWER on IntegriCloud