From 0da6bedaa0dc37e9c2786b5adf5d496d6d51fd0a Mon Sep 17 00:00:00 2001 From: John Goerzen Date: Sat, 2 Aug 2008 15:31:43 -0500 Subject: [PATCH] Eliminate one more fsync --- offlineimap/folder/Maildir.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/offlineimap/folder/Maildir.py b/offlineimap/folder/Maildir.py index c7f5be0..d1921b8 100644 --- a/offlineimap/folder/Maildir.py +++ b/offlineimap/folder/Maildir.py @@ -198,13 +198,14 @@ class MaildirFolder(BaseFolder): os.path.join(tmpdir, messagename)) os.unlink(os.path.join(tmpdir, tmpmessagename)) - try: - # fsync the directory (safer semantics in Linux) - fd = os.open(tmpdir, os.O_RDONLY) - os.fsync(fd) - os.close(fd) - except: - pass + if self.dofsync: + try: + # fsync the directory (safer semantics in Linux) + fd = os.open(tmpdir, os.O_RDONLY) + os.fsync(fd) + os.close(fd) + except: + pass self.messagelist[uid] = {'uid': uid, 'flags': [], 'filename': os.path.join(tmpdir, messagename)}