Commit dd0c60b7 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Add O_ANYWRITE mask.

parent 8a2ea6d4
...@@ -13,7 +13,6 @@ path/to/zipfile to /config/zipmount ...@@ -13,7 +13,6 @@ path/to/zipfile to /config/zipmount
import ( import (
"github.com/hanwen/go-fuse/fuse" "github.com/hanwen/go-fuse/fuse"
"log" "log"
"os"
"path/filepath" "path/filepath"
"sync" "sync"
"strings" "strings"
...@@ -186,7 +185,7 @@ func (me *MultiZipFs) Unlink(name string) (code fuse.Status) { ...@@ -186,7 +185,7 @@ func (me *MultiZipFs) Unlink(name string) (code fuse.Status) {
} }
func (me *MultiZipFs) Open(name string, flags uint32) (file fuse.RawFuseFile, code fuse.Status) { func (me *MultiZipFs) Open(name string, flags uint32) (file fuse.RawFuseFile, code fuse.Status) {
if 0 != flags&uint32(os.O_WRONLY|os.O_RDWR|os.O_APPEND) { if 0 != flags&uint32(fuse.O_ANYWRITE) {
return nil, fuse.EPERM return nil, fuse.EPERM
} }
......
...@@ -136,6 +136,10 @@ func (me *ZipFileFuse) GetAttr(name string) (*fuse.Attr, fuse.Status) { ...@@ -136,6 +136,10 @@ func (me *ZipFileFuse) GetAttr(name string) (*fuse.Attr, fuse.Status) {
} }
func (me *ZipFileFuse) Open(name string, flags uint32) (file fuse.RawFuseFile, code fuse.Status) { func (me *ZipFileFuse) Open(name string, flags uint32) (file fuse.RawFuseFile, code fuse.Status) {
if flags & fuse.O_ANYWRITE != 0 {
return nil, fuse.EPERM
}
_, zfile := me.tree.Lookup(name) _, zfile := me.tree.Lookup(name)
if zfile == nil { if zfile == nil {
return nil, fuse.ENOENT return nil, fuse.ENOENT
......
package fuse package fuse
import ( import (
"os"
"syscall" "syscall"
) )
...@@ -80,6 +81,8 @@ const ( ...@@ -80,6 +81,8 @@ const (
// TODO - get this from a canonical place. // TODO - get this from a canonical place.
PAGESIZE = 4096 PAGESIZE = 4096
O_ANYWRITE = uint32(os.O_WRONLY|os.O_RDWR|os.O_APPEND|os.O_CREATE|os.O_TRUNC)
) )
type Status int32 type Status int32
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment