mirror of https://github.com/borgbackup/borg.git
Merge pull request #2100 from ThomasWaldmann/fix-double-magic
creating a new segment: use "xb" mode, fixes #2099
This commit is contained in:
commit
528891aee9
|
@ -670,7 +670,8 @@ class LoggedIO:
|
||||||
if not os.path.exists(dirname):
|
if not os.path.exists(dirname):
|
||||||
os.mkdir(dirname)
|
os.mkdir(dirname)
|
||||||
sync_dir(os.path.join(self.path, 'data'))
|
sync_dir(os.path.join(self.path, 'data'))
|
||||||
self._write_fd = open(self.segment_filename(self.segment), 'ab')
|
# play safe: fail if file exists (do not overwrite existing contents, do not append)
|
||||||
|
self._write_fd = open(self.segment_filename(self.segment), 'xb')
|
||||||
self._write_fd.write(MAGIC)
|
self._write_fd.write(MAGIC)
|
||||||
self.offset = MAGIC_LEN
|
self.offset = MAGIC_LEN
|
||||||
return self._write_fd
|
return self._write_fd
|
||||||
|
|
Loading…
Reference in New Issue