diff options
author | Steve Slaven <bpk@hoopajoo.net> | 2009-07-28 17:04:22 (GMT) |
---|---|---|
committer | Steve Slaven <bpk@hoopajoo.net> | 2009-07-28 17:04:22 (GMT) |
commit | 1d90b688c485fa1421db7103926af73cc2b6b6b1 (patch) | |
tree | deb84bf20c46d60a7ffe0cc00568867128e53bdf | |
parent | e359815f31d40f3f7f8c6ed4b225a0181e6c2b8d (diff) | |
download | fusearchive-1d90b688c485fa1421db7103926af73cc2b6b6b1.zip fusearchive-1d90b688c485fa1421db7103926af73cc2b6b6b1.tar.gz fusearchive-1d90b688c485fa1421db7103926af73cc2b6b6b1.tar.bz2 |
Bug fixes to extend via seek(), properly setting dirty flag and not trying
to pull up block -1
-rwxr-xr-x | fusearchive.py | 16 |
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) |