Path: blob/main/filesystems/ext2/files/patch-fuse-ext2_fuse-ext2.c
18157 views
--- fuse-ext2/fuse-ext2.c.orig 2019-05-09 08:29:33 UTC1+++ fuse-ext2/fuse-ext2.c2@@ -18,15 +18,14 @@3* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA4*/56+#include <stdbool.h>7#include "fuse-ext2.h"89static const char *HOME = "http://github.com/alperakcan/fuse-ext2/";1011#if __FreeBSD__ == 1012-static char def_opts[] = "allow_other,default_permissions,local,";13static char def_opts_rd[] = "noappledouble,";14#else15-static char def_opts[] = "allow_other,default_permissions,";16static char def_opts_rd[] = "";17#endif1819@@ -171,8 +170,10 @@ static int parse_options (int argc, char *argv[], stru20static char * parse_mount_options (const char *orig_opts, struct extfs_data *opts)21{22char *options, *s, *opt, *val, *ret;23+ bool allow_other = true;24+ bool default_permissions = true;2526- ret = malloc(strlen(def_opts) + strlen(def_opts_rd) + strlen(orig_opts) + 256 + PATH_MAX);27+ ret = malloc(strlen(def_opts_rd) + strlen(orig_opts) + 256 + PATH_MAX);28if (!ret) {29return NULL;30}31@@ -231,6 +232,14 @@ static char * parse_mount_options (const char *orig_op32#if __FreeBSD__ == 1033strcat(ret, "force,");34#endif35+ } else if (!strcmp(opt, "noallow_other")) {36+ allow_other = false;37+ strcat(ret, opt);38+ strcat(ret, ",");39+ } else if (!strcmp(opt, "nodefault_permissions")) {40+ default_permissions = false;41+ strcat(ret, opt);42+ strcat(ret, ",");43} else { /* Probably FUSE option. */44strcat(ret, opt);45if (val) {46@@ -246,7 +255,13 @@ static char * parse_mount_options (const char *orig_op47opts->readonly = 1;48}4950- strcat(ret, def_opts);51+ if (allow_other)52+ strcat(ret, "allow_other,");53+ if (default_permissions)54+ strcat(ret, "default_permissions,");55+#if __FreeBSD__ == 1056+ strcat(ret, "local,");57+#endif58if (opts->readonly == 1) {59strcat(ret, def_opts_rd);60strcat(ret, "ro,");616263