summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2010-07-11 11:11:38 +1200
committerLars Wirzenius <liw@liw.fi>2010-07-11 11:11:38 +1200
commite11eaecf92bf123697f04ee375e3a258e4ffd7f1 (patch)
tree258d413d06f159ccf39eb90a911166cc8e2d3b66
parentf2b0585e6c5ba74693ce48eae24b78b602a08478 (diff)
downloadobnam-e11eaecf92bf123697f04ee375e3a258e4ffd7f1.tar.gz
Fix LocalFS to use bytes_written and bytes_read.
-rw-r--r--obnamlib/vfs_local.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/obnamlib/vfs_local.py b/obnamlib/vfs_local.py
index 7ba752e0..e580bb3d 100644
--- a/obnamlib/vfs_local.py
+++ b/obnamlib/vfs_local.py
@@ -116,6 +116,7 @@ class LocalFS(obnamlib.VirtualFileSystem):
if not chunk:
break
chunks.append(chunk)
+ self.bytes_read += len(chunk)
f.close()
data = "".join(chunks)
return data
@@ -131,6 +132,7 @@ class LocalFS(obnamlib.VirtualFileSystem):
chunk = contents[pos:pos+self.chunk_size]
os.write(fd, chunk)
pos += len(chunk)
+ self.bytes_written += len(chunk)
os.close(fd)
try:
os.link(name, path)
@@ -138,7 +140,6 @@ class LocalFS(obnamlib.VirtualFileSystem):
os.remove(name)
raise
os.remove(name)
- self.written += len(contents)
def overwrite_file(self, pathname, contents, make_backup=True):
path = self.join(pathname)
@@ -149,6 +150,7 @@ class LocalFS(obnamlib.VirtualFileSystem):
chunk = contents[pos:pos+self.chunk_size]
os.write(fd, chunk)
pos += len(chunk)
+ self.bytes_written += len(chunk)
os.close(fd)
# Rename existing to have a .bak suffix. If _that_ file already
@@ -168,7 +170,6 @@ class LocalFS(obnamlib.VirtualFileSystem):
os.remove(bak)
except OSError:
pass
- self.written += len(contents)
def listdir(self, dirname):
return os.listdir(self.join(dirname))