Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-ports
Path: blob/main/filesystems/ext2/files/patch-fuse-ext2_fuse-ext2.c
18157 views
1
--- fuse-ext2/fuse-ext2.c.orig 2019-05-09 08:29:33 UTC
2
+++ fuse-ext2/fuse-ext2.c
3
@@ -18,15 +18,14 @@
4
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
5
*/
6
7
+#include <stdbool.h>
8
#include "fuse-ext2.h"
9
10
static const char *HOME = "http://github.com/alperakcan/fuse-ext2/";
11
12
#if __FreeBSD__ == 10
13
-static char def_opts[] = "allow_other,default_permissions,local,";
14
static char def_opts_rd[] = "noappledouble,";
15
#else
16
-static char def_opts[] = "allow_other,default_permissions,";
17
static char def_opts_rd[] = "";
18
#endif
19
20
@@ -171,8 +170,10 @@ static int parse_options (int argc, char *argv[], stru
21
static char * parse_mount_options (const char *orig_opts, struct extfs_data *opts)
22
{
23
char *options, *s, *opt, *val, *ret;
24
+ bool allow_other = true;
25
+ bool default_permissions = true;
26
27
- ret = malloc(strlen(def_opts) + strlen(def_opts_rd) + strlen(orig_opts) + 256 + PATH_MAX);
28
+ ret = malloc(strlen(def_opts_rd) + strlen(orig_opts) + 256 + PATH_MAX);
29
if (!ret) {
30
return NULL;
31
}
32
@@ -231,6 +232,14 @@ static char * parse_mount_options (const char *orig_op
33
#if __FreeBSD__ == 10
34
strcat(ret, "force,");
35
#endif
36
+ } else if (!strcmp(opt, "noallow_other")) {
37
+ allow_other = false;
38
+ strcat(ret, opt);
39
+ strcat(ret, ",");
40
+ } else if (!strcmp(opt, "nodefault_permissions")) {
41
+ default_permissions = false;
42
+ strcat(ret, opt);
43
+ strcat(ret, ",");
44
} else { /* Probably FUSE option. */
45
strcat(ret, opt);
46
if (val) {
47
@@ -246,7 +255,13 @@ static char * parse_mount_options (const char *orig_op
48
opts->readonly = 1;
49
}
50
51
- strcat(ret, def_opts);
52
+ if (allow_other)
53
+ strcat(ret, "allow_other,");
54
+ if (default_permissions)
55
+ strcat(ret, "default_permissions,");
56
+#if __FreeBSD__ == 10
57
+ strcat(ret, "local,");
58
+#endif
59
if (opts->readonly == 1) {
60
strcat(ret, def_opts_rd);
61
strcat(ret, "ro,");
62
63