]> code.delx.au - offlineimap/commitdiff
Eliminate one more fsync
authorJohn Goerzen <jgoerzen@complete.org>
Sat, 2 Aug 2008 20:31:43 +0000 (15:31 -0500)
committerJohn Goerzen <jgoerzen@complete.org>
Sat, 2 Aug 2008 20:31:43 +0000 (15:31 -0500)
offlineimap/folder/Maildir.py

index c7f5be0d6bf95e929f91187438b14d30c7c421b3..d1921b88b03ece0c9f27a1be2809a79b7258105e 100644 (file)
@@ -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)}