diff options
-rw-r--r-- | FuseArchive/ChunkFile.py | 16 | ||||
-rw-r--r-- | FuseArchive/FileSystem.py | 2 |
2 files changed, 16 insertions, 2 deletions
diff --git a/FuseArchive/ChunkFile.py b/FuseArchive/ChunkFile.py index 8e4f2eb..62d2c1e 100644 --- a/FuseArchive/ChunkFile.py +++ b/FuseArchive/ChunkFile.py @@ -116,11 +116,25 @@ class ChunkFile(object): # files works (in the create a read-only file for writing case) src = "./tree" + path logging.debug( "Saving fh for " + src ) - nflags = os.O_RDWR | os.O_APPEND + + if flags == 0: + # o_rdonly + nflags = flags + else: + # We need rw to cp -a on r/o files, actually we need rw on + # almost any write only operation to read out our chunks list + nflags = os.O_RDWR | os.O_APPEND + if flags & os.O_CREAT: logging.debug( "Adding O_CREAT" ) nflags = nflags | os.O_CREAT + logging.debug( "Flags & O_RDONLY %d" % (flags & os.O_RDONLY) ); + logging.debug( "Flags & O_RDWR %d" % (flags & os.O_RDWR) ); + logging.debug( "Flags & O_WRONLY %d" % (flags & os.O_WRONLY) ); + logging.debug( "Flags & O_APPEND %d" % (flags & os.O_APPEND) ); + logging.debug( "Flags & O_CREAT %d" % (flags & os.O_CREAT) ); + self.file = os.fdopen( os.open( src, nflags, *mode ), flag2mode( nflags ) ) diff --git a/FuseArchive/FileSystem.py b/FuseArchive/FileSystem.py index 31470c5..64eae86 100644 --- a/FuseArchive/FileSystem.py +++ b/FuseArchive/FileSystem.py @@ -19,7 +19,7 @@ class FileSystem(fuse.Fuse): def getattr(self, path): treefile = "./tree" + path - if os.path.isfile( treefile ): + if os.path.isfile( treefile ) and not os.path.islink( treefile ): logging.debug( "Delegating getattr to File for " + path ) # Check in the dirty cache first (to handle lseek and the |