Skip to content

Commit

Permalink
vfs: short circuit read when at EOF
Browse files Browse the repository at this point in the history
Signed-off-by: Rob Browning <[email protected]>
  • Loading branch information
rlbdv committed Dec 8, 2018
1 parent b15fcfd commit d73c6d3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/bup/vfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,11 @@ def tell(self):
return self.ofs

def read(self, count=-1):
size = self._compute_size()
if self.ofs >= size:
return ''
if count < 0:
count = self._compute_size() - self.ofs
count = size - self.ofs
if not self.reader or self.reader.ofs != self.ofs:
self.reader = _ChunkReader(self._repo, self.oid, self.ofs)
try:
Expand Down

0 comments on commit d73c6d3

Please sign in to comment.