diff options
Diffstat (limited to 'FuseArchive')
-rw-r--r-- | FuseArchive/ChunkFile.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/FuseArchive/ChunkFile.py b/FuseArchive/ChunkFile.py index e19a9fb..b9f114f 100644 --- a/FuseArchive/ChunkFile.py +++ b/FuseArchive/ChunkFile.py @@ -217,7 +217,7 @@ class ChunkFile(object): self.chunks[ self.chunk_index ] = self.chunk # Flush if we have too many dirty chunks - if self.dirty_chunks > dirty_flush: + if self.dirty_chunks >= dirty_flush: self._flush_chunks() # This flushes any cached chunks @@ -288,7 +288,12 @@ class ChunkFile(object): if len( self.chunks ) - 1 < index: logging.debug( "Not enough chunks %d, need %d, extending" % ( len( self.chunks ), index + 1 ) ) - this_index = 0 + + # Start with our last block, in case we need to null pad it out + this_index = len( self.chunks ) - 1 + if this_index < 0: + this_index = 0 + while this_index < index: self._load_chunk( this_index ) fill_null = self.chunk_size - len(self.chunk) |