From da80f7cbdaaf1b0306f7c776f628397554c26e33 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Mon, 7 Sep 2015 11:27:40 +0100 Subject: [PATCH] [Core] Only fsync the directory if GNU constant exists * Doesn't exist on Windows. --- deluge/core/torrentmanager.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py index 28d1e17ce..e996923c7 100644 --- a/deluge/core/torrentmanager.py +++ b/deluge/core/torrentmanager.py @@ -756,9 +756,10 @@ class TorrentManager(component.Component): os.rename(filepath_bak, filepath) else: # Sync the rename operations for the directory - dirfd = os.open(os.path.dirname(filepath), os.O_DIRECTORY) - os.fsync(dirfd) - os.close(dirfd) + if hasattr(os, 'O_DIRECTORY'): + dirfd = os.open(os.path.dirname(filepath), os.O_DIRECTORY) + os.fsync(dirfd) + os.close(dirfd) return True def get_queue_position(self, torrent_id):