diff options
-rwxr-xr-x | fusearchive.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/fusearchive.py b/fusearchive.py index 15d4d60..9c13d68 100755 --- a/fusearchive.py +++ b/fusearchive.py @@ -551,6 +551,8 @@ class FuseArchive(Fuse): def _load_chunk( self, index ): # If the current chunk is the same as the chunk we're loading # just return + logging.debug( "_load_chunk: " + str( index ) ) + if index == self.chunk_index: logging.debug( "Load chunk is same as current chunk, all done" ) return @@ -671,20 +673,21 @@ class FuseArchive(Fuse): rest = offset % self.chunk_size logging.debug( "This chunk falls on index: " + str( index ) + " rest: " + str( rest ) ) + logging.debug( "We have " + str( len( self.chunks ) ) + " chunks" ) # If index is higher than the number of blocks we current have it's a seek hole, so we need to extend our blocks out # We know these need to essentially be zeroed up to this size since - while index > len( self.chunks ): + if len( self.chunks ) - 1 < index: logging.debug( "Not enough chunks " + str( len( self.chunks ) ) + ", need " + str( index ) + ", extending" ) - this_index = -1 + this_index = 0 while this_index < index: - this_index += 1 self._load_chunk( this_index ) fill_null = self.chunk_size - len(self.chunk) logging.debug( "Filling this chunk with null, bytes: " + str( fill_null ) ) self.chunk += "\0" * fill_null self.chunk_modified = True + this_index += 1 self._load_chunk( index ) |