mirror of
https://github.com/borgbackup/borg.git
synced 2025-01-04 06:21:46 +00:00
fuse: add parameter check to ItemCache.get to make potential failures more clear
This commit is contained in:
parent
783d01f621
commit
5d22078f35
1 changed files with 4 additions and 1 deletions
|
@ -43,7 +43,10 @@ def add(self, item):
|
|||
return pos + self.offset
|
||||
|
||||
def get(self, inode):
|
||||
self.fd.seek(inode - self.offset, io.SEEK_SET)
|
||||
offset = inode - self.offset
|
||||
if offset < 0:
|
||||
raise ValueError('ItemCache.get() called with an invalid inode number')
|
||||
self.fd.seek(offset, io.SEEK_SET)
|
||||
item = next(msgpack.Unpacker(self.fd, read_size=1024))
|
||||
return Item(internal_dict=item)
|
||||
|
||||
|
|
Loading…
Reference in a new issue