Allow others fuse option. ()

Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
This commit is contained in:
Antonio Navarro Perez 2020-11-13 12:06:33 +01:00 committed by GitHub
parent bd81446da6
commit 2b33ec5f25
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 38 additions and 18 deletions

View file

@ -18,14 +18,17 @@ type Handler struct {
c *torrent.Client
s *stats.Torrent
fuseAllowOther bool
hosts map[string]*fuse.FileSystemHost
}
func NewHandler(c *torrent.Client, s *stats.Torrent) *Handler {
func NewHandler(c *torrent.Client, s *stats.Torrent, fuseAllowOther bool) *Handler {
return &Handler{
c: c,
s: s,
hosts: make(map[string]*fuse.FileSystemHost),
c: c,
s: s,
fuseAllowOther: fuseAllowOther,
hosts: make(map[string]*fuse.FileSystemHost),
}
}
@ -76,7 +79,13 @@ func (s *Handler) Mount(mpc *config.MountPoint, ef config.EventFunc) error {
// TODO improve error handling here
go func() {
ok := host.Mount(mpc.Path, nil)
var config []string
if mpc.AllowOther || s.fuseAllowOther {
config = append(config, "-o", "allow_other")
}
ok := host.Mount(mpc.Path, config)
if !ok {
log.WithField("path", mpc.Path).Error("error trying to mount filesystem")
}