diff options
author | Poul-Henning Kamp <phk@FreeBSD.org> | 1999-10-09 11:54:14 +0000 |
---|---|---|
committer | Poul-Henning Kamp <phk@FreeBSD.org> | 1999-10-09 11:54:14 +0000 |
commit | 73dd3167345391095dd7c75aefa870a5bce92397 (patch) | |
tree | 33cadf04c808cb0644aedaa306f8f3c0987ba3fe /sbin/i386 | |
parent | 1d64c295bbdb773ca3d62cdb5a9eec06e12799c8 (diff) | |
download | src-73dd3167345391095dd7c75aefa870a5bce92397.tar.gz src-73dd3167345391095dd7c75aefa870a5bce92397.zip |
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
Notes
Notes:
svn path=/head/; revision=52055
Diffstat (limited to 'sbin/i386')
-rw-r--r-- | sbin/i386/mount_msdos/mount_msdos.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/sbin/i386/mount_msdos/mount_msdos.c b/sbin/i386/mount_msdos/mount_msdos.c index dfb15df9a23e..ebb646adbacc 100644 --- a/sbin/i386/mount_msdos/mount_msdos.c +++ b/sbin/i386/mount_msdos/mount_msdos.c @@ -87,7 +87,7 @@ main(argc, argv) struct msdosfs_args args; struct stat sb; int c, error, mntflags, set_gid, set_uid, set_mask; - char *dev, *dir, ndir[MAXPATHLEN+1]; + char *dev, *dir, mntpath[MAXPATHLEN]; struct vfsconf vfc; mntflags = set_gid = set_uid = set_mask = 0; @@ -145,15 +145,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 = -2; /* unchecked anyway on DOS fs */ @@ -162,8 +160,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; @@ -183,7 +181,7 @@ main(argc, argv) if (error) errx(EX_OSERR, "msdos filesystem is not available"); - if (mount(vfc.vfc_name, dir, mntflags, &args) < 0) + if (mount(vfc.vfc_name, mntpath, mntflags, &args) < 0) err(EX_OSERR, "%s", dev); exit (0); |