mirror of https://github.com/borgbackup/borg.git
fuse: add parameter check to ItemCache.get to make potential failures more clear
This commit is contained in:
parent
783d01f621
commit
5d22078f35
|
@ -43,7 +43,10 @@ class ItemCache:
|
||||||
return pos + self.offset
|
return pos + self.offset
|
||||||
|
|
||||||
def get(self, inode):
|
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))
|
item = next(msgpack.Unpacker(self.fd, read_size=1024))
|
||||||
return Item(internal_dict=item)
|
return Item(internal_dict=item)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue