diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/fuse.c | 20 |
1 files changed, 17 insertions, 3 deletions
@@ -1487,9 +1487,17 @@ static void set_stat(struct fuse *f, fuse_ino_t nodeid, struct stat *stbuf) { if (!f->conf.use_ino) stbuf->st_ino = nodeid; - if (f->conf.set_mode) - stbuf->st_mode = (stbuf->st_mode & S_IFMT) | - (0777 & ~f->conf.umask); + if (f->conf.set_mode) { + if (f->conf.dmask && S_ISDIR(stbuf->st_mode)) + stbuf->st_mode = (stbuf->st_mode & S_IFMT) | + (0777 & ~f->conf.dmask); + else if (f->conf.fmask) + stbuf->st_mode = (stbuf->st_mode & S_IFMT) | + (0777 & ~f->conf.fmask); + else + stbuf->st_mode = (stbuf->st_mode & S_IFMT) | + (0777 & ~f->conf.umask); + } if (f->conf.set_uid) stbuf->st_uid = f->conf.uid; if (f->conf.set_gid) @@ -4681,6 +4689,10 @@ static const struct fuse_opt fuse_lib_opts[] = { FUSE_LIB_OPT("no_rofd_flush", no_rofd_flush, 1), FUSE_LIB_OPT("umask=", set_mode, 1), FUSE_LIB_OPT("umask=%o", umask, 0), + FUSE_LIB_OPT("fmask=", set_mode, 1), + FUSE_LIB_OPT("fmask=%o", fmask, 0), + FUSE_LIB_OPT("dmask=", set_mode, 1), + FUSE_LIB_OPT("dmask=%o", dmask, 0), FUSE_LIB_OPT("uid=", set_uid, 1), FUSE_LIB_OPT("uid=%d", uid, 0), FUSE_LIB_OPT("gid=", set_gid, 1), @@ -4734,6 +4746,8 @@ void fuse_lib_help(struct fuse_args *args) " -o [no]auto_cache enable caching based on modification times (off)\n" " -o no_rofd_flush disable flushing of read-only fd on close (off)\n" " -o umask=M set file permissions (octal)\n" +" -o fmask=M set file permissions (octal)\n" +" -o dmask=M set dir permissions (octal)\n" " -o uid=N set file owner\n" " -o gid=N set file group\n" " -o entry_timeout=T cache timeout for names (1.0s)\n" |