aboutsummaryrefslogtreecommitdiffstats
path: root/FuseArchive/ChunkFile.py
diff options
context:
space:
mode:
authorSteve Slaven <bpk@hoopajoo.net>2009-11-04 00:28:34 (GMT)
committerSteve Slaven <bpk@hoopajoo.net>2009-11-04 00:28:34 (GMT)
commit0fa8bcc144320f7b37c0f3363e1e178e5935d2b2 (patch)
treeef5222a1303ddba74cf056e29203a0b66b65c773 /FuseArchive/ChunkFile.py
parentf43d183be8cfafa3c14fafa2b3de887db368fb53 (diff)
downloadfusearchive-0fa8bcc144320f7b37c0f3363e1e178e5935d2b2.zip
fusearchive-0fa8bcc144320f7b37c0f3363e1e178e5935d2b2.tar.gz
fusearchive-0fa8bcc144320f7b37c0f3363e1e178e5935d2b2.tar.bz2
Fix for o_rdonly and getattr delegation
Diffstat (limited to 'FuseArchive/ChunkFile.py')
-rw-r--r--FuseArchive/ChunkFile.py16
1 files changed, 15 insertions, 1 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 ) )