diff options
author | Tom Rhodes <trhodes@FreeBSD.org> | 2003-08-12 20:06:56 +0000 |
---|---|---|
committer | Tom Rhodes <trhodes@FreeBSD.org> | 2003-08-12 20:06:56 +0000 |
commit | c98a31cad3be5e324706ef5df99da87bcb688f47 (patch) | |
tree | 3c2fc714329283a20ad88a038c936261060715ba /sbin | |
parent | 22088599d231d4e1ba34bef40dddfd6347101b09 (diff) | |
download | src-c98a31cad3be5e324706ef5df99da87bcb688f47.tar.gz src-c98a31cad3be5e324706ef5df99da87bcb688f47.zip |
Add a '-M mask' option so that users can have different
masks for files and directories. This should make some
of the Midnight Commander users happy.
Remove an extra ')' in the manual page.
PR: 35699
Submitted by: Eugene Grosbein <eugen@grosbein.pp.ru> (original version)
Tested by: simon
Notes
Notes:
svn path=/head/; revision=118837
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/mount_msdosfs/mount_msdosfs.8 | 17 | ||||
-rw-r--r-- | sbin/mount_msdosfs/mount_msdosfs.c | 22 |
2 files changed, 34 insertions, 5 deletions
diff --git a/sbin/mount_msdosfs/mount_msdosfs.8 b/sbin/mount_msdosfs/mount_msdosfs.8 index 147f1f1ab43b..8eee35c4d47b 100644 --- a/sbin/mount_msdosfs/mount_msdosfs.8 +++ b/sbin/mount_msdosfs/mount_msdosfs.8 @@ -42,6 +42,7 @@ .Op Fl u Ar uid .Op Fl g Ar gid .Op Fl m Ar mask +.Op Fl M Ar mask .Op Fl s .Op Fl l .Op Fl 9 @@ -104,14 +105,28 @@ read, write, and execute permissions for files, but others should only have read and execute permissions. See .Xr chmod 1 -for more information about octal file modes.) +for more information about octal file modes. Only the nine low-order bits of .Ar mask are used. +The value of +.Ar -M +is used if it is supplied and +.Ar -m +is omitted. The default .Ar mask is taken from the directory on which the file system is being mounted. +.It Fl M Ar mask +Specify the maximum file permissions for directories +in the file system. +The value of +.Ar -m +is used if it is supplied and +.Ar -M +is omitted. +See the previous option's description for details. .It Fl s Force behaviour to ignore and not generate Win'95 long filenames. diff --git a/sbin/mount_msdosfs/mount_msdosfs.c b/sbin/mount_msdosfs/mount_msdosfs.c index 187dc13304c9..061e3cb0c5c1 100644 --- a/sbin/mount_msdosfs/mount_msdosfs.c +++ b/sbin/mount_msdosfs/mount_msdosfs.c @@ -88,14 +88,14 @@ main(argc, argv) { struct msdosfs_args args; struct stat sb; - int c, mntflags, set_gid, set_uid, set_mask; + int c, mntflags, set_gid, set_uid, set_mask, set_dirmask; char *dev, *dir, mntpath[MAXPATHLEN]; - mntflags = set_gid = set_uid = set_mask = 0; + mntflags = set_gid = set_uid = set_mask = set_dirmask = 0; (void)memset(&args, '\0', sizeof(args)); args.magic = MSDOSFS_ARGSMAGIC; - while ((c = getopt(argc, argv, "sl9u:g:m:o:L:W:")) != -1) { + while ((c = getopt(argc, argv, "sl9u:g:m:M:o:L:W:")) != -1) { switch (c) { #ifdef MSDOSFSMNT_GEMDOSFS case 'G': @@ -123,6 +123,10 @@ main(argc, argv) args.mask = a_mask(optarg); set_mask = 1; break; + case 'M': + args.dirmask = a_mask(optarg); + set_dirmask = 1; + break; case 'L': load_ultable(&args, optarg); args.flags |= MSDOSFSMNT_ULTABLE; @@ -144,6 +148,15 @@ main(argc, argv) if (optind + 2 != argc) usage(); + if (set_mask && !set_dirmask) { + args.dirmask = args.mask; + set_dirmask = 1; + } + else if (set_dirmask && !set_mask) { + args.mask = args.dirmask; + set_mask = 1; + } + dev = argv[optind]; dir = argv[optind + 1]; @@ -169,7 +182,8 @@ main(argc, argv) if (!set_gid) args.gid = sb.st_gid; if (!set_mask) - args.mask = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO); + args.mask = args.dirmask = + sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO); } if (mount("msdosfs", mntpath, mntflags, &args) < 0) |