mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-27 18:28:42 +00:00
parent
b8fe7b6b83
commit
02f3daebbe
1 changed files with 1 additions and 3 deletions
|
@ -1395,8 +1395,7 @@ def recover_segment(self, segment, filename):
|
||||||
with open(backup_filename, 'rb') as backup_fd:
|
with open(backup_filename, 'rb') as backup_fd:
|
||||||
# note: file must not be 0 size (windows can't create 0 size mapping)
|
# note: file must not be 0 size (windows can't create 0 size mapping)
|
||||||
with mmap.mmap(backup_fd.fileno(), 0, access=mmap.ACCESS_READ) as mm:
|
with mmap.mmap(backup_fd.fileno(), 0, access=mmap.ACCESS_READ) as mm:
|
||||||
data = memoryview(mm)
|
with memoryview(mm) as data, open(filename, 'wb') as fd:
|
||||||
with open(filename, 'wb') as fd:
|
|
||||||
fd.write(MAGIC)
|
fd.write(MAGIC)
|
||||||
while len(data) >= self.header_fmt.size:
|
while len(data) >= self.header_fmt.size:
|
||||||
crc, size, tag = self.header_fmt.unpack(data[:self.header_fmt.size])
|
crc, size, tag = self.header_fmt.unpack(data[:self.header_fmt.size])
|
||||||
|
@ -1408,7 +1407,6 @@ def recover_segment(self, segment, filename):
|
||||||
continue
|
continue
|
||||||
fd.write(data[:size])
|
fd.write(data[:size])
|
||||||
data = data[size:]
|
data = data[size:]
|
||||||
data.release()
|
|
||||||
|
|
||||||
def read(self, segment, offset, id, read_data=True):
|
def read(self, segment, offset, id, read_data=True):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue