aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Slaven <bpk@hoopajoo.net>2009-07-28 16:53:12 (GMT)
committerSteve Slaven <bpk@hoopajoo.net>2009-07-28 16:53:12 (GMT)
commite359815f31d40f3f7f8c6ed4b225a0181e6c2b8d (patch)
treea891d13086ba52ae271f2e77a9f79985cadae3d2
parentc2b70dc5dfa2437b4a9c0770e7d01abcbf2acbd5 (diff)
downloadfusearchive-e359815f31d40f3f7f8c6ed4b225a0181e6c2b8d.zip
fusearchive-e359815f31d40f3f7f8c6ed4b225a0181e6c2b8d.tar.gz
fusearchive-e359815f31d40f3f7f8c6ed4b225a0181e6c2b8d.tar.bz2
Always open the main fh for serialization in rw mode
-rwxr-xr-xfusearchive.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/fusearchive.py b/fusearchive.py
index ba50084..1c8cfb6 100755
--- a/fusearchive.py
+++ b/fusearchive.py
@@ -289,6 +289,7 @@ class FuseArchiveSerializer:
f = gzip.GzipFile( None, "wb", gzip_compress_level, fh )
#f = fh
cPickle.dump( obj, f )
+ del f
fh.flush()
@staticmethod
@@ -503,8 +504,9 @@ class FuseArchive(Fuse):
# files works (in the create a read-only file for writing case)
src = "./tree" + path
logging.debug( "Saving fh for " + src )
- self.file = os.fdopen( os.open( src, flags, *mode ),
- flag2mode( flags ) )
+ nflags = os.O_RDWR
+ self.file = os.fdopen( os.open( src, nflags, *mode ),
+ flag2mode( nflags ) )
if preexist:
# Read in file info table
@@ -517,7 +519,7 @@ class FuseArchive(Fuse):
self.chunks = magic[ 'chunks' ]
self.chunk_size = magic[ 'chunk_size' ]
except Exception, e:
- logging.critical( e )
+ logging.critical( self.orig_path + ": " + str( e ) )
else:
if self.wr:
logging.debug( "File doesn't exist and we're going to write, creating temp empty file" )
@@ -567,6 +569,8 @@ class FuseArchive(Fuse):
# This simply puts the chunk data inside our current chunks at chunk_index
def _save_chunk(self):
if self.chunk_modified:
+ logging.debug( "Saving chunk " + str(self.chunk_index) )
+
# Make sure we have room for this chunk
size = len( self.chunks )
if self.chunk_index >= size:
@@ -753,7 +757,7 @@ class FuseArchive(Fuse):
} )
-
+ logging.debug( "_fflush exit" )
return 1