mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-24 08:45:13 +00:00
do os.fsync like recommended in the python docs (gets a fileno, not file object, also do a flush first)
This commit is contained in:
parent
0e5ef376bf
commit
74768511e1
2 changed files with 3 additions and 2 deletions
|
@ -481,7 +481,7 @@ def write_msgpack(filename, d):
|
|||
with open(filename + '.tmp', 'wb') as fd:
|
||||
msgpack.pack(d, fd)
|
||||
fd.flush()
|
||||
os.fsync(fd)
|
||||
os.fsync(fd.fileno())
|
||||
os.rename(filename + '.tmp', filename)
|
||||
|
||||
|
||||
|
|
|
@ -577,6 +577,7 @@ def close_segment(self):
|
|||
if self._write_fd:
|
||||
self.segment += 1
|
||||
self.offset = 0
|
||||
os.fsync(self._write_fd)
|
||||
self._write_fd.flush()
|
||||
os.fsync(self._write_fd.fileno())
|
||||
self._write_fd.close()
|
||||
self._write_fd = None
|
||||
|
|
Loading…
Reference in a new issue