diff options
Diffstat (limited to 'fusearchive.py')
-rwxr-xr-x | fusearchive.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/fusearchive.py b/fusearchive.py index 328ee49..b1ebc36 100755 --- a/fusearchive.py +++ b/fusearchive.py @@ -360,6 +360,7 @@ class FuseArchive(Fuse): dmsg( 2, "Writing to " + self.orig_path ) self.file.seek(offset) self.file.write(buf) + self.modified = True return len(buf) def release(self, flags): @@ -367,11 +368,14 @@ class FuseArchive(Fuse): dmsg( 2, "Release: " + self.orig_path ) self.file.close() - dmsg( 2, "Copying working file back to storage: " + \ - self.tmp_name + " -> " + self.orig_path ) + if self.modified: + dmsg( 2, "Copying working file back to storage: " + \ + self.tmp_name + " -> " + self.orig_path ) - #pdb.set_trace() - deflate( self.tmp_name, "./tree" + self.orig_path ); + #pdb.set_trace() + deflate( self.tmp_name, "./tree" + self.orig_path ) + else: + dmsg( 2, "File not modified, not copying back" ) dmsg( 2, "Deleting old file: " + self.tmp_name ) os.unlink( self.tmp_name ); @@ -396,6 +400,7 @@ class FuseArchive(Fuse): return os.fstat(self.fd) def ftruncate(self, len): + self.modified = True self.file.truncate(len) def lock(self, cmd, owner, **kw): |