]> granicus.if.org Git - python/commitdiff
[Patch #1599256 from David Watson] check that os.fsync is available before using it
authorAndrew M. Kuchling <amk@amk.ca>
Thu, 14 Dec 2006 18:59:07 +0000 (18:59 +0000)
committerAndrew M. Kuchling <amk@amk.ca>
Thu, 14 Dec 2006 18:59:07 +0000 (18:59 +0000)
Lib/mailbox.py

index 108d874fe09ea7c35948c5667b8aece223894da3..f9af494956ce43208955f2a48cbb39fd0a6b9913 100755 (executable)
@@ -1887,7 +1887,8 @@ def _create_temporary(path):
 def _sync_flush(f):
     """Ensure changes to file f are physically on disk."""
     f.flush()
-    os.fsync(f.fileno())
+    if hasattr(os, 'fsync'):
+        os.fsync(f.fileno())
 
 def _sync_close(f):
     """Close file f, ensuring all changes are physically on disk."""