aboutsummaryrefslogtreecommitdiffstats
path: root/fusearchive.py
diff options
context:
space:
mode:
authorSteve Slaven <bpk@hoopajoo.net>2009-07-23 16:53:57 (GMT)
committerSteve Slaven <bpk@hoopajoo.net>2009-07-23 16:53:57 (GMT)
commitb90720764eab6c999fe7a4ef5169bb82fb080c22 (patch)
tree6e37520a4ddd6b199be6c15c92b157abbc08567a /fusearchive.py
parent505e75eee4c35bdf7cefb1fedaac99ee920b6177 (diff)
downloadfusearchive-b90720764eab6c999fe7a4ef5169bb82fb080c22.zip
fusearchive-b90720764eab6c999fe7a4ef5169bb82fb080c22.tar.gz
fusearchive-b90720764eab6c999fe7a4ef5169bb82fb080c22.tar.bz2
Only save if file was modified
Diffstat (limited to 'fusearchive.py')
-rwxr-xr-xfusearchive.py13
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):