From 1d90b688c485fa1421db7103926af73cc2b6b6b1 Mon Sep 17 00:00:00 2001 From: Steve Slaven Date: Tue, 28 Jul 2009 10:04:22 -0700 Subject: Bug fixes to extend via seek(), properly setting dirty flag and not trying to pull up block -1 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) -- cgit v0.10.2