From fc8be58b636b1fbb8e21720990811e269ada8b8b Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Sun, 22 Jan 2017 16:54:06 +0100 Subject: [PATCH] SyncFile: fix use of fd object after close --- borg/repository.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/borg/repository.py b/borg/repository.py index dd49b368b..2cf000108 100644 --- a/borg/repository.py +++ b/borg/repository.py @@ -829,8 +829,9 @@ class LoggedIO: # tell the OS that it does not need to cache what we just wrote, # avoids spoiling the cache for the OS and other processes. os.posix_fadvise(self._write_fd.fileno(), 0, 0, os.POSIX_FADV_DONTNEED) + dirname = os.path.dirname(self._write_fd.name) self._write_fd.close() - sync_dir(os.path.dirname(self._write_fd.name)) + sync_dir(dirname) self._write_fd = None