aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xfusearchive.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/fusearchive.py b/fusearchive.py
index 1c8cfb6..8573176 100755
--- a/fusearchive.py
+++ b/fusearchive.py
@@ -654,12 +654,20 @@ class FuseArchive(Fuse):
while index > len( self.chunks ):
logging.debug( "Not enough chunks " + str( len( self.chunks ) ) + ", need " +
str( index ) + ", extending" )
- self.chunk_index = -1
- while self.chunk_index < index:
- self._load_chunk( self.chunk_index + 1 )
+ this_index = -1
+ while this_index < index:
+ self._load_chunk( this_index + 1 )
fill_null = self.chunk_size - len(self.chunk)
- logging.debug( "Filling this chunk with null, bytes: " + fill_null )
+ logging.debug( "Filling this chunk with null, bytes: " + str( fill_null ) )
self.chunk += "\0" * fill_null
+ self.chunk_modified = True
+
+ # Now check if this chunk needs to be extended
+ if len( self.chunk ) < rest:
+ fill_null = rest - len(self.chunk)
+ logging.debug( "Filling final chunk with null, bytes: " + str( fill_null ) )
+ self.chunk += "\0" * fill_null
+ self.chunk_modified = True
buf_offset = 0
buf_len = len(buf)