diff --git a/cmd/sharefs/fuse-helper.c b/cmd/sharefs/fuse-operations.c similarity index 99% rename from cmd/sharefs/fuse-helper.c rename to cmd/sharefs/fuse-operations.c index a1c511b..ecff1ad 100644 --- a/cmd/sharefs/fuse-helper.c +++ b/cmd/sharefs/fuse-operations.c @@ -9,7 +9,7 @@ /* TODO(ophestra): remove after 05ce67fea99ca09cd4b6625cff7aec9cc222dd5a reaches a release */ #include -#include "fuse-helper.h" +#include "fuse-operations.h" /* MUST_TRANSLATE_PATHNAME translates a userspace pathname to a relative pathname; * the resulting address points to a constant string or part of pathname, it is never heap allocated. */ diff --git a/cmd/sharefs/fuse-helper.h b/cmd/sharefs/fuse-operations.h similarity index 100% rename from cmd/sharefs/fuse-helper.h rename to cmd/sharefs/fuse-operations.h diff --git a/cmd/sharefs/fuse.go b/cmd/sharefs/fuse.go index c9b24b2..1a17f80 100644 --- a/cmd/sharefs/fuse.go +++ b/cmd/sharefs/fuse.go @@ -3,12 +3,12 @@ package main /* #cgo pkg-config: --static fuse3 -#include "fuse-helper.h" +#include "fuse-operations.h" #include #include extern void *sharefs_init(struct fuse_conn_info *conn, struct fuse_config *cfg); -void sharefs_destroy(void *private_data); +extern void sharefs_destroy(void *private_data); typedef void (*closure)(); static inline struct fuse_opt _FUSE_OPT_END() { return (struct fuse_opt)FUSE_OPT_END; }; @@ -202,6 +202,9 @@ func unsafeAddArgument(args *fuseArgs, arg string) { } func _main(argc int, argv **C.char) int { + // don't mask creation mode, kernel already did that + syscall.Umask(0) + args := C.struct_fuse_args{argc: C.int(argc), argv: argv, allocated: 1} // this causes the kernel to enforce access control based on diff --git a/cmd/sharefs/main.go b/cmd/sharefs/main.go index 44a7e51..60924e0 100644 --- a/cmd/sharefs/main.go +++ b/cmd/sharefs/main.go @@ -5,7 +5,6 @@ import ( "os" "path" "runtime" - "syscall" ) // executableName is the [path.Base] name of the executable that started the current process. @@ -24,8 +23,5 @@ func main() { log.SetFlags(0) log.SetPrefix(executableName + ": ") - // don't mask creation mode, kernel already did that - syscall.Umask(0) - os.Exit(_main(len(os.Args), copyStrings(os.Args...))) }